本文整理匯總了PHP中ItemManager::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP ItemManager::getInstance方法的具體用法?PHP ItemManager::getInstance怎麽用?PHP ItemManager::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ItemManager
的用法示例。
在下文中一共展示了ItemManager::getInstance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: service
public function service()
{
$customer = $this->getCustomer();
$customerEmail = strtolower($customer->getEmail());
$customerCartManager = CustomerCartManager::getInstance($this->config, $this->args);
if (isset($_REQUEST['update_basket_count'])) {
$totalCount = $customerCartManager->getCustomerCartTotalCount($customerEmail);
$jsonArr = array('status' => "ok", "cart_items_count" => $totalCount);
echo json_encode($jsonArr);
return true;
}
$add_count = 1;
if (isset($_REQUEST['add_count'])) {
$add_count = $this->secure($_REQUEST['add_count']);
}
if (isset($_REQUEST['item_id'])) {
$item_id = $this->secure($_REQUEST['item_id']);
}
$itemManager = ItemManager::getInstance($this->config, $this->args);
if (isset($item_id)) {
$itemDto = $itemManager->selectByPK($item_id);
if (!isset($itemDto)) {
$jsonArr = array('status' => "err", "errText" => "Item is no more available!");
echo json_encode($jsonArr);
return false;
}
$last_dealer_price = $itemDto->getDealerPrice();
}
$customerCartManager->addToCart($customerEmail, $item_id, 0, $last_dealer_price, $add_count);
$totalCount = $customerCartManager->getCustomerCartTotalCount($customerEmail);
$jsonArr = array('status' => "ok", "cart_items_count" => $totalCount);
echo json_encode($jsonArr);
return true;
}
示例2: load
public function load()
{
$dealsManager = DealsManager::getInstance($this->config, $this->args);
$itemManager = ItemManager::getInstance($this->config, $this->args);
$this->addParam("itemManager", $itemManager);
//today deals
$todayDealDto = $dealsManager->getTodayDeal();
if ($todayDealDto) {
$itemId = $todayDealDto->getItemId();
$todayItem = $itemManager->getItemsForOrder($itemId, $this->getUserId(), $this->getUserLevel(), true);
if (isset($todayItem) && ($todayItem->getIsDealerOfThisCompany() == 0 || $this->getUserLevel() === UserGroups::$ADMIN)) {
$totalDurationSeconds = intval($todayDealDto->getDurationMinutes()) * 60;
$currentTimeInSeconds = time();
$dealStartTimeInSeconds = strtotime($todayDealDto->getDate() . ' ' . $todayDealDto->getStartTime());
$dealEndTimeInSeconds = strtotime($todayDealDto->getDate() . ' ' . $todayDealDto->getStartTime()) + $totalDurationSeconds;
$dealIsEnable = $currentTimeInSeconds > $dealStartTimeInSeconds && $currentTimeInSeconds < $dealEndTimeInSeconds - 10;
if ($dealIsEnable) {
$this->addParam("todayItem", $todayItem);
$this->addParam("today_deal_seconds_to_end", $dealEndTimeInSeconds - $currentTimeInSeconds);
$this->addParam('today_deal_promo_code', $todayDealDto->getPromoCode());
$this->addParam('today_deal_fixed_price', $todayDealDto->getPriceAmd());
}
}
}
//lighting deals
/* $lightingDeals = $dealsManager->getLightingDeals();
if (!empty($lightingDeals)) {
$this->addParam("lightingDeals", $lightingDeals);
} */
}
示例3: load
public function load()
{
$company_id = $_REQUEST['company_id'];
$used_columns_indexes_array = array(2, 1, 9, 3, 4, 5, 6, 7);
//explode(',', $_REQUEST['used_columns_indexes']);
$importItemsTempManager = ImportItemsTempManager::getInstance($this->config, $this->args);
$categoryHierarchyManager = CategoryHierarchyManager::getInstance($this->config, $this->args);
$categoryManager = CategoryManager::getInstance($this->config, $this->args);
$customerLogin = $this->getCustomerLogin();
$priceRowsDtos = $importItemsTempManager->getUserCurrentPriceChangedRows($customerLogin);
$columnNames = ImportPriceManager::getColumnNamesMap($used_columns_indexes_array);
$rootDto = $categoryManager->getRoot();
$firstLevelCategoriesHierarchyDtos = $categoryHierarchyManager->getCategoryChildren($rootDto->getId());
$firstLevelCategoriesNamesDtos = $categoryHierarchyManager->getCategoriesNamesByParentCategoryId($rootDto->getId());
$firstLevelCategoriesIds = array();
foreach ($firstLevelCategoriesHierarchyDtos as $key => $category) {
$firstLevelCategoriesIds[] = $category->getChildId();
}
$firstLevelCategoriesNames = array();
foreach ($firstLevelCategoriesNamesDtos as $key => $category) {
$firstLevelCategoriesNames[] = $category->getDisplayName();
}
$itemManager = ItemManager::getInstance($this->config, $this->args);
$companyAllItems = $itemManager->getCompanyItems($company_id, true);
$convertDtosArrayToArrayMapById = $this->convertDtosArrayToArrayMapById($companyAllItems);
$this->addParam('stockItemsDtosMappedByIds', $convertDtosArrayToArrayMapById);
$this->addParam('columnNames', $columnNames);
$this->addParam('priceRowsDtos', $priceRowsDtos);
$this->addParam('firstLevelCategoriesNames', $firstLevelCategoriesNames);
$this->addParam('firstLevelCategoriesIds', $firstLevelCategoriesIds);
list($changedRowIds, $changedFields) = $this->findChanges($priceRowsDtos, $convertDtosArrayToArrayMapById, $columnNames);
$this->addParam('changedRowsIds', $changedRowIds);
$this->addParam('changedFields', $changedFields);
}
示例4: __construct
/**
* Initializes DB mappers
*
* @param object $config
* @param object $args
* @return
*/
function __construct($config, $args)
{
$this->config = $config;
$this->args = $args;
$this->itemManager = ItemManager::getInstance($this->config, $this->args);
$this->pcComponentValidatorManager = PcComponentValidatorManager::getInstance($this->config, $this->args);
}
示例5: __construct
/**
* Initializes DB mappers
*
* @param object $config
* @param object $args
* @return
*/
function __construct($config, $args)
{
$this->mapper = BundleItemsMapper::getInstance();
$this->config = $config;
$this->args = $args;
$this->itemManager = ItemManager::getInstance($this->config, $this->args);
}
示例6: load
public function load()
{
$item_id = intval($_REQUEST['item_id']);
$itemManager = ItemManager::getInstance($this->config, $this->args);
$itemDto = $itemManager->selectByPK($item_id);
$this->addParam('itemDto', $itemDto);
}
示例7: load
public function load()
{
$companyManager = CompanyManager::getInstance($this->config, $this->args);
$customer = $this->sessionManager->getUser();
$userLevel = $customer->getLevel();
if ($userLevel == UserGroups::$ADMIN) {
$allCompaniesDtos = $companyManager->getAllCompanies(true, true);
} else {
$allCompaniesDtos = array($companyManager->selectByPK($customer->getId()));
}
$allCompaniesNames = array();
$allCompaniesIds = array();
foreach ($allCompaniesDtos as $key => $company) {
$allCompaniesNames[] = $company->getName();
$allCompaniesIds[] = $company->getId();
}
if (isset($_REQUEST["company_id"])) {
$selectedCompanyId = $this->secure($_REQUEST["company_id"]);
} else {
$selectedCompanyId = $allCompaniesIds[0];
}
$this->addParam('selectedCompanyId', $selectedCompanyId);
$this->addParam('allCompaniesNames', $allCompaniesNames);
$this->addParam('allCompaniesIds', $allCompaniesIds);
$itemManager = ItemManager::getInstance($this->config, $this->args);
$allCompanyItems = $itemManager->getCompanyItems($selectedCompanyId, true);
$this->addParam('company_items', $allCompanyItems);
if (isset($_COOKIE['copied_item_id'])) {
$this->addParam('copied_item_id', $_COOKIE['copied_item_id']);
}
$this->addParam('itemManager', $itemManager);
}
示例8: load
public function load()
{
if (isset($_REQUEST["item_id"])) {
$item_id = $_REQUEST["item_id"];
if (strpos($item_id, ',') !== false) {
$item_id = explode(',', $item_id);
}
$itemManager = ItemManager::getInstance($this->config, $this->args);
$userLevel = $this->getUserLevel();
$userId = $this->getUserId();
if (is_array($item_id)) {
$itemDto = array();
foreach ($item_id as $key => $itemId) {
$itemD = $itemManager->getItemsForOrder($itemId, $userId, $userLevel);
if ($itemD != null) {
$itemDto[] = $itemD;
}
}
$itemPicturesCount = 0;
} else {
$itemDto = $itemManager->getItemsForOrder($item_id, $userId, $userLevel);
if ($itemDto == null) {
//TODO tell user about that IMPORTANT
return;
}
$itemPicturesCount = $itemDto->getPicturesCount();
}
$this->addParam("item_id", $item_id);
$this->addParam("item", $itemDto);
$this->addParam("item_pictures_count", $itemPicturesCount);
$this->addParam("itemManager", $itemManager);
}
}
示例9: load
public function load()
{
//Load First Level Categories from DB
$categoryManager = CategoryManager::getInstance($this->config, $this->args);
$categoryHierarchyManager = CategoryHierarchyManager::getInstance($this->config, $this->args);
$rootDto = $categoryManager->getRoot();
$firstLevelCategoriesHierarchyDtos = $categoryHierarchyManager->getCategoryChildren($rootDto->getId());
$firstLevelCategoriesNamesDtos = $categoryHierarchyManager->getCategoriesNamesByParentCategoryId($rootDto->getId());
$firstLevelCategoriesIds = array();
foreach ($firstLevelCategoriesHierarchyDtos as $key => $category) {
$firstLevelCategoriesIds[] = $category->getChildId();
}
$firstLevelCategoriesNames = array();
foreach ($firstLevelCategoriesNamesDtos as $key => $category) {
$firstLevelCategoriesNames[] = $category->getDisplayName();
}
$this->addParam('firstLevelCategoriesNames', $firstLevelCategoriesNames);
$this->addParam('firstLevelCategoriesIds', $firstLevelCategoriesIds);
$item_warranty_options = explode(',', $this->getCmsVar('item_warranty_options'));
$this->addParam('item_warranty_options', $item_warranty_options);
$itemManager = ItemManager::getInstance($this->config, $this->args);
if (isset($_REQUEST['item_id'])) {
$itemId = $this->secure($_REQUEST['item_id']);
$itemDto = $itemManager->selectByPK($itemId);
$this->addParam('item_pictures_count', $itemDto->getPicturesCount());
$this->addParam('item_id', $itemDto->getId());
$this->addParam('item_title', $itemDto->getDisplayName());
$this->addParam('item_available', $itemManager->isItemAvailable($itemDto));
$this->addParam('short_description', $itemDto->getShortDescription());
$this->addParam('full_description', $itemDto->getFullDescription());
$this->addParam('dealer_price', $itemDto->getDealerPrice());
$this->addParam('vat_price', $itemDto->getVatPrice());
$this->addParam('dealer_price_amd', $itemDto->getDealerPriceAmd());
$this->addParam('vat_price_amd', $itemDto->getVatPriceAmd());
$this->addParam('selected_warranty_option', $itemDto->getWarranty());
$this->addParam('item_model', $itemDto->getModel());
$this->addParam('item_brand', $itemDto->getBrand());
$this->addParam('order_index_in_price', $itemDto->getOrderIndexInPrice());
$this->addParam('item_available_till_date', $itemDto->getItemAvailableTillDate());
$itemCategoriesIds = $itemDto->getCategoriesIds();
$itemCategoriesIds = trim($itemCategoriesIds, ',');
assert(!empty($itemCategoriesIds));
$itemCategoriesIds = explode(',', $itemCategoriesIds);
$selectedRootCategoryId = $itemCategoriesIds[0];
$subCategoriesIdsArray = array_slice($itemCategoriesIds, 1);
$this->addParam('selectedRootCategoryId', $selectedRootCategoryId);
$this->addParam('sub_categories_ids', join(',', $subCategoriesIdsArray));
} else {
$selectedRootCategoryId = $firstLevelCategoriesHierarchyDtos[0]->getChildId();
$this->addParam('selected_warranty_option', $item_warranty_options[12]);
$this->addParam('selectedRootCategoryId', $selectedRootCategoryId);
$this->addParam('sub_categories_ids', '');
}
$item_availability_options_names = array("Today", "2 days", "3 days", "1 week", "2 weeks", "1 month");
$item_availability_options_values = array(0, 1, 2, 6, 13, 29);
$this->addParam('item_availability_options_names', $item_availability_options_names);
$this->addParam('item_availability_options_values', $item_availability_options_values);
$this->addParam('item_availability_selected', $item_availability_options_values[3]);
$this->addParam('company_id', intval($this->secure($_REQUEST["company_id"])));
}
示例10: service
public function service()
{
$itemManager = ItemManager::getInstance($this->config, $this->args);
$itemManager->UpdateAllAmdItemsPrices();
$jsonArr = array('status' => "ok");
echo json_encode($jsonArr);
return true;
}
示例11: __construct
/**
* Initializes DB mappers
*
* @param object $config
* @param object $args
* @return
*/
function __construct($config, $args)
{
$this->mapper = OrderDetailsMapper::getInstance();
$this->config = $config;
$this->args = $args;
$this->customerCartManager = CustomerCartManager::getInstance($this->config, $this->args);
$this->itemManager = ItemManager::getInstance($this->config, $this->args);
$this->bundleItemsManager = BundleItemsManager::getInstance($this->config, $this->args);
}
示例12: service
public function service()
{
$companyId = $_REQUEST['company_id'];
$itemManager = ItemManager::getInstance($this->config, $this->args);
$itemManager->hideCompanyItems($companyId);
$jsonArr = array('status' => "ok");
echo json_encode($jsonArr);
return false;
}
示例13: initVars
private function initVars()
{
$customer = $this->getCustomer();
if ($customer) {
$this->customerEmail = strtolower($customer->getEmail());
$this->customerCartManager = CustomerCartManager::getInstance($this->config, $this->args);
$this->bundleItemsManager = BundleItemsManager::getInstance($this->config, $this->args);
$this->itemManager = ItemManager::getInstance($this->config, $this->args);
}
}
示例14: load
public function load()
{
$loadPage = 0;
if (isset($_REQUEST['load_page'])) {
$loadPage = $_REQUEST['load_page'];
}
if ($loadPage == 1) {
$this->addParam("page_loaded", 1);
$companyManager = CompanyManager::getInstance($this->config, $this->args);
$allCompanyDtos = $companyManager->getAllCompanies(false, false);
$companyNames = array();
$companyIds = array();
foreach ($allCompanyDtos as $companyDto) {
$companyNames[] = $companyDto->getName();
$companyIds[] = $companyDto->getId();
}
$this->addParam("companyNames", $companyNames);
$this->addParam("companyIds", $companyIds);
$selectedCompanyId = $companyIds[0];
if (isset($_REQUEST['selected_company_id'])) {
$selectedCompanyId = intval($_REQUEST['selected_company_id']);
}
$includeHiddens = false;
if (isset($_REQUEST['include_hiddens'])) {
$includeHiddens = intval($_REQUEST['include_hiddens']) == 1;
}
$this->addParam('include_hiddens', $includeHiddens);
$emptyModel = 0;
if (isset($_REQUEST['empty_model'])) {
$emptyModel = intval($_REQUEST['empty_model']);
}
$this->addParam('empty_model', $emptyModel);
$emptyShortSpec = 0;
if (isset($_REQUEST['empty_short_spec'])) {
$emptyShortSpec = intval($_REQUEST['empty_short_spec']);
}
$this->addParam('empty_short_spec', $emptyShortSpec);
$emptyFullSpec = 0;
if (isset($_REQUEST['empty_full_spec'])) {
$emptyFullSpec = intval($_REQUEST['empty_full_spec']);
}
$this->addParam('empty_full_spec', $emptyFullSpec);
$picturesCount = 'any';
if (isset($_REQUEST['pictures_count'])) {
$picturesCount = strtolower($_REQUEST['pictures_count']);
}
$this->addParam('pictures_count', $picturesCount);
$itemManager = ItemManager::getInstance($this->config, $this->args);
$items = $itemManager->getItemsByAdminConditions($selectedCompanyId, $includeHiddens, $emptyModel, $emptyShortSpec, $emptyFullSpec, $picturesCount);
$this->addParam("items", $items);
} else {
$this->addParam("page_loaded", 0);
}
}
示例15: service
public function service()
{
$itemId = $this->secure($_REQUEST['item_id']);
$root = $this->secure($_REQUEST['root_category_id']);
$subCategories = $this->secure($_REQUEST['sub_categories_ids']);
$subCategoriesArray = explode(',', trim($subCategories, ','));
$categoriesIdsArray = $subCategoriesArray;
array_unshift($categoriesIdsArray, $root);
$itemManager = ItemManager::getInstance($this->config, $this->args);
$itemManager->setItemCategories($itemId, $categoriesIdsArray);
$this->ok();
}