public function service()
 {
     $categoryManager = CategoryManager::getInstance($this->config, $this->args);
     $categoryHierarchyManager = CategoryHierarchyManager::getInstance($this->config, $this->args);
     $categoryId = $this->secure($_REQUEST["category_id"]);
     $adminManager = AdminManager::getInstance($this->config, $this->args);
     $adminId = $this->sessionManager->getUser()->getId();
     $adminDto = $adminManager->selectByPK($adminId);
     if ($adminDto) {
         if ($categoryHierarchyManager->hasCategoryChildren($categoryId)) {
             $jsonArr = array('status' => "err", "errText" => "You can only remove 'Leaf' categories!");
             echo json_encode($jsonArr);
             return false;
         }
         $categoryManager->deleteByPK($categoryId);
         $categoryHierarchyManager->removeCategoryHierarchyByChildCategoryID($categoryId);
         //todo remove category name from items table `categories_names` field.
         $jsonArr = array('status' => "ok", "message" => "ok");
         echo json_encode($jsonArr);
         return true;
     } else {
         $jsonArr = array('status' => "err", "errText" => "System Error: You are not Admin!");
         echo json_encode($jsonArr);
         return false;
     }
 }
Пример #2
0
 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"])));
 }
 /**
  * Returns an singleton instance of this class
  *
  * @param object $config
  * @param object $args
  * @return
  */
 public static function getInstance($config, $args)
 {
     if (self::$instance == null) {
         self::$instance = new CategoryHierarchyManager($config, $args);
     }
     return self::$instance;
 }
Пример #4
0
 function __construct($rootId = 0)
 {
     $this->rootNodeId = $rootId;
     $this->categoryManager = CategoryManager::getInstance(null, null);
     $this->categoryHierarchyManager = CategoryHierarchyManager::getInstance(null, null);
     $this->rootNode = $this->initNodes($this->rootNodeId);
 }
 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);
 }
Пример #6
0
 /**
  * Initializes DB mappers
  *
  * @param object $config
  * @param object $args
  * @return
  */
 function __construct($config, $args)
 {
     $this->mapper = CategoryMapper::getInstance();
     $this->config = $config;
     $this->args = $args;
     $this->categoryHierarchyManager = CategoryHierarchyManager::getInstance($this->config, $this->args);
     $this->initCache();
 }
Пример #7
0
 public function load()
 {
     //new items import level
     $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->getUserCurrentPriceNewRows($customerLogin);
     foreach ($priceRowsDtos as $dto) {
         $itemModel = $dto->getModel();
         if (empty($itemModel)) {
             $model = $importItemsTempManager->findModelFromItemTitle($dto->getDisplayName());
             if (!empty($model)) {
                 $dto->setSupposedModel($model);
             }
         } else {
             $dto->setSupposedModel($itemModel);
         }
     }
     $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();
     }
     $this->addParam('columnNames', $columnNames);
     $this->addParam('priceRowsDtos', $priceRowsDtos);
     $this->addParam('firstLevelCategoriesNames', $firstLevelCategoriesNames);
     $this->addParam('firstLevelCategoriesIds', $firstLevelCategoriesIds);
     if (isset($_REQUEST['new_items_row_ids'])) {
         $this->addParam('new_items_row_ids', explode(',', $_REQUEST['new_items_row_ids']));
     }
     //$json_parsed_price = $_REQUEST['json_parsed_price'];
     //$parsed_price_array = json_decode($json_parsed_price);
     /* $companyItems = $itemManager->getCompanyItems($company_id, true);
     
               $stockItemModels = array();
               $stockItemNames = array();
               $stockItemDealerPrices = array();
               $stockItemVatPrices = array();
               $stockItemIsHidden = array();
               foreach ($companyItems as $itemDto) {
               $stockItemModels[] =
               } */
 }
 public function load()
 {
     $this->categoryManager = CategoryManager::getInstance($this->config, $this->args);
     $this->categoryHierarchyManager = CategoryHierarchyManager::getInstance($this->config, $this->args);
     $rootDto = $this->categoryManager->getRoot();
     $this->treeViewModel = new ItemsCategoryTreeViewModel($rootDto->getId(), $rootDto->getDisplayName(), $rootDto, true);
     $this->fillTreeViewModel($rootDto);
     $treeView = new ItemsCategoryTreeView($this->treeViewModel, true, "my_tree");
     $this->addParam('treeView', $treeView);
     $this->addParam("ItemCategoriesLeftBarWidth", $this->getCmsVar("item_categories_left_bar_width"));
     $this->addParam("ItemCategoriesRightBarWidth", $this->getParam("wholePageWidth") - $this->getCmsVar("item_categories_left_bar_width"));
 }
 public function load()
 {
     $this->categoryManager = CategoryManager::getInstance($this->config, $this->args);
     $this->categoryHierarchyManager = CategoryHierarchyManager::getInstance($this->config, $this->args);
     $rootCategoryId = $this->secure($_REQUEST["item_root_category"]);
     $rootCategoryDto = $this->categoryManager->getCategoryById($rootCategoryId);
     $this->treeViewModel = new SubCategorySelectionTreeViewModel($rootCategoryDto->getId(), $rootCategoryDto->getDisplayName(), $rootCategoryDto, true);
     $this->fillTreeViewModel($rootCategoryDto);
     $treeView = new SubCategorySelectionTreeView($this->treeViewModel, false, "sub_category_tree");
     $treeView->setRowsIndent(25);
     $this->addParam('selectSubCatTreeView', $treeView);
 }
Пример #10
0
 public function service()
 {
     $categoryManager = new CategoryManager($this->config, $this->args);
     $categoryHierarchyManager = new CategoryHierarchyManager($this->config, $this->args);
     $categoryTitle = $this->secure($_REQUEST["category_title"]);
     $parentCategoryId = $this->secure($_REQUEST["parent_category_id"]);
     $adminManager = new AdminManager($this->config, $this->args);
     $adminId = $this->sessionManager->getUser()->getId();
     $adminDto = $adminManager->selectByPK($adminId);
     if ($adminDto) {
         $sortIndex = count($categoryHierarchyManager->getCategoryChildrenIdsArray($parentCategoryId)) + 1;
         $categoryId = $categoryManager->addCategory($categoryTitle, '0', '0', '1');
         $categoryHierarchyManager->addSubCategoryToCategory($parentCategoryId, $categoryId, $sortIndex);
         $jsonArr = array('status' => "ok", "message" => "ok");
         echo json_encode($jsonArr);
         return true;
     } else {
         $jsonArr = array('status' => "err", "errText" => "System Error: You are not Admin!");
         echo json_encode($jsonArr);
         return false;
     }
 }
Пример #11
0
 private function initRootCategories()
 {
     $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);
 }
Пример #12
0
 public function load()
 {
     $this->addParam("searchLeftBarWidth", $this->getCmsVar("search_left_bar_width"));
     $itemManager = ItemManager::getInstance($this->config, $this->args);
     $this->setDescriptionTagValue('Serach any item you want. PC, Laptop, Tablet, Computer, Printer, Monitor...');
     $this->setTitleTagValue('Pcstore Search');
     if (isset($_COOKIE['copied_item_id'])) {
         $this->addParam('copied_item_id', $_COOKIE['copied_item_id']);
     }
     if (isset($this->args[0])) {
         $this->large_view_load_enable = true;
         $selectedItemId = $this->args[0];
         $this->addParam('selected_item_id', $selectedItemId);
     }
     $this->current_page_number = 1;
     if (isset($_REQUEST["spg"])) {
         $this->current_page_number = $_REQUEST["spg"];
     }
     $userLevel = $this->getUserLevel();
     $this->categoryManager = CategoryManager::getInstance($this->config, $this->args);
     $this->categoryHierarchyManager = CategoryHierarchyManager::getInstance($this->config, $this->args);
     $selectedCompanyId = $this->initCompaniesSelectionList();
     $selectedCategoryId = 0;
     if (!empty($_REQUEST["cid"])) {
         $selectedCategoryId = $this->secure($_REQUEST["cid"]);
     }
     $selected_category_property_ids = isset($_REQUEST["scpids"]) ? $this->secure($_REQUEST["scpids"]) : '';
     $groupedProperties = null;
     if (!empty($selected_category_property_ids)) {
         $this->addParam('selected_category_property_ids', $selected_category_property_ids);
         $selected_category_property_ids = explode(',', $selected_category_property_ids);
         $groupedProperties = $this->groupCategoryProperties($selected_category_property_ids);
     } else {
         $selected_category_property_ids = array();
         $groupedProperties = array();
     }
     $item_search_limit_rows = intval($this->getCmsVar("item_search_limit_rows"));
     $userId = $this->getUserId();
     $price_range_min = isset($_REQUEST["prmin"]) ? $this->secure($_REQUEST["prmin"]) : '';
     $price_range_max = isset($_REQUEST["prmax"]) ? $this->secure($_REQUEST["prmax"]) : '';
     $this->addParam('search_item_price_range_min_value', $price_range_min);
     $this->addParam('search_item_price_range_max_value', $price_range_max);
     if (!empty($price_range_min) && strlen($price_range_min) > 0) {
         $price_range_min = floatval($this->secure($_REQUEST["prmin"])) / floatval($this->getCmsVar('us_dollar_exchange'));
     }
     if (!empty($price_range_max) && strlen($price_range_max) > 0) {
         $price_range_max = floatval($this->secure($_REQUEST["prmax"])) / floatval($this->getCmsVar('us_dollar_exchange'));
     }
     $orderByFieldName = $this->initSortBySelectionList();
     if ($orderByFieldName === 'relevance') {
         $orderByFieldName = null;
     }
     $search_text = isset($_REQUEST["st"]) ? $this->secure($_REQUEST["st"]) : '';
     $this->addParam("search_text", $search_text);
     if (!empty($search_text)) {
         $cmsSearchRequestsManager = CmsSearchRequestsManager::getInstance($this->config, $this->args);
         $cmsSearchRequestsManager->addRow($search_text, date('Y-m-d H:i:s'), $_REQUEST['win_uid']);
     }
     $show_only_vat_items = 0;
     if (isset($_REQUEST['shov'])) {
         $show_only_vat_items = $this->secure($_REQUEST['shov']);
         $this->addParam('show_only_vat_items', 1);
     }
     $show_only_non_picture_items = null;
     if (isset($_REQUEST["show_only_non_picture_items"])) {
         $show_only_non_picture_items = intval($_REQUEST["show_only_non_picture_items"]);
         $this->addParam('show_only_non_picture_items', $show_only_non_picture_items);
     }
     $show_only_no_short_spec_items = null;
     if (isset($_REQUEST["show_only_no_short_spec_items"])) {
         $show_only_no_short_spec_items = intval($_REQUEST["show_only_no_short_spec_items"]);
         $this->addParam('show_only_no_short_spec_items', $show_only_no_short_spec_items);
     }
     $show_only_no_full_spec_items = null;
     if (isset($_REQUEST["show_only_no_full_spec_items"])) {
         $show_only_no_full_spec_items = intval($_REQUEST["show_only_no_full_spec_items"]);
         $this->addParam('show_only_no_full_spec_items', $show_only_no_full_spec_items);
     }
     searchStared:
     $offset = $item_search_limit_rows * ($this->current_page_number - 1);
     $foundItems = $itemManager->searchItemsByTitle($userId, $userLevel, $search_text, $selectedCompanyId, $price_range_min, $price_range_max, $selectedCategoryId, $groupedProperties, $show_only_vat_items, $show_only_non_picture_items, $show_only_no_short_spec_items, $show_only_no_full_spec_items, $offset, $item_search_limit_rows, $orderByFieldName);
     $itemsDtosOnlyCategories = $itemManager->searchItemsByTitleRowsCount($userId, $search_text, $selectedCompanyId, $price_range_min, $price_range_max, $selectedCategoryId, null, $show_only_vat_items, $show_only_non_picture_items, $show_only_no_short_spec_items, $show_only_no_full_spec_items);
     $this->totalItemsRowsCount = 0;
     $this->categories_count_array = array();
     $selectedCategoryGroupedSubProperties = array();
     $selectedCategorySubTreeIds = array();
     $propertyViewIsVisible = false;
     $selectedCategoryDto = $this->categoryManager->getCategoryById($selectedCategoryId);
     if ($selectedCategoryDto->getLastClickable() == 1) {
         $selectedCategoryGroupedSubProperties = $this->categoryHierarchyManager->getCategoryGroupedSubProperties($selectedCategoryId);
         $selectedCategorySubTreeIds = $this->categoryHierarchyManager->getCategorySubTreeIds($selectedCategoryId);
         $propertyViewIsVisible = true;
     }
     foreach ($itemsDtosOnlyCategories as $itemDto) {
         $categoriesIds = trim($itemDto->getCategoriesIds(), ',');
         $categoriesIdsArray = explode(',', $categoriesIds);
         $ItemIsVisible = true;
         foreach ($groupedProperties as $propertiesGroupStaticCategoryId => $propIdsArray) {
             if (!(empty($propIdsArray) || count(array_intersect($categoriesIdsArray, $propIdsArray)) > 0)) {
                 $ItemIsVisible = false;
                 break;
             }
         }
         if ($ItemIsVisible) {
             $this->totalItemsRowsCount++;
         }
         //here calculating categories count which is valid for only category menu items not properties
         if (!$propertyViewIsVisible) {
             foreach ($categoriesIdsArray as $catId) {
                 if (!in_array($catId, $selectedCategorySubTreeIds)) {
                     if (!array_key_exists($catId, $this->categories_count_array)) {
                         $this->categories_count_array[$catId] = 1;
                     } else {
                         $this->categories_count_array[$catId] += 1;
                     }
                 }
             }
         } else {
             //here calculating future selecting properties count
             foreach ($selectedCategoryGroupedSubProperties as $propertyGroupCategoryId => $propertiesIds) {
                 $isItemVisibleForCurrentlySelectedOtherPropertyGroup = true;
                 foreach ($groupedProperties as $propertiesGroupStaticCategoryId => $propIdsArray) {
                     if ($propertiesGroupStaticCategoryId == $propertyGroupCategoryId) {
                         continue;
                     }
                     if (!(empty($propIdsArray) || count(array_intersect($categoriesIdsArray, $propIdsArray)) > 0)) {
                         $isItemVisibleForCurrentlySelectedOtherPropertyGroup = false;
                         break;
                     }
                 }
                 foreach ($propertiesIds as $proertyId) {
                     if (in_array($proertyId, $selected_category_property_ids)) {
                         //this is for optimization
                         continue;
                     }
                     if ($isItemVisibleForCurrentlySelectedOtherPropertyGroup && in_array($proertyId, $categoriesIdsArray)) {
                         if (!array_key_exists($proertyId, $this->categories_count_array)) {
                             $this->categories_count_array[$proertyId] = 1;
                         } else {
                             $this->categories_count_array[$proertyId] += 1;
                         }
                     }
                 }
             }
         }
     }
     //if page number exceed last page number then go to last page
     if (count($foundItems) === 0 && $this->totalItemsRowsCount > 0) {
         $lastPageNumber = ceil($this->totalItemsRowsCount / $item_search_limit_rows);
         $this->current_page_number = $lastPageNumber;
         goto searchStared;
     }
     $this->addParam("foundItems", $foundItems);
     $this->addParam("itemManager", $itemManager);
     $this->addParam("totalItemsRowsCount", $this->totalItemsRowsCount);
     ///credit items calculation
     $creditManager = CreditManager::getInstance($this->config, $this->args);
     $creditSuppliersManager = CreditSuppliersManager::getInstance($this->config, $this->args);
     $allCreditSuppliersDtos = $creditSuppliersManager->getAllCreditSuppliers();
     $allCreditSuppliersDtos = $creditSuppliersManager->getCreditSuppliersInMapArrayById($allCreditSuppliersDtos);
     $creditPossibleMonths = $creditManager->getAllSuppliersCombinePossibleMonths($allCreditSuppliersDtos);
     $this->addParam("creditPossibleMonthsValues", $creditPossibleMonths);
     $this->addParam("defaultSelectedCreditMonths", end($creditPossibleMonths));
     $defaultCreditSupplierDto = reset($allCreditSuppliersDtos);
     $this->addParam("defaultSupplierCommission", floatval($defaultCreditSupplierDto->getCommission()));
     $this->addParam("defaultCreditInterestMonthlyRatio", floatval($defaultCreditSupplierDto->getAnnualInterestPercent() / 100 / 12 + $defaultCreditSupplierDto->getAnnualCommision() / 100 / 12));
     //categories
     if ($selectedCategoryDto->getLastClickable() == '0') {
         $itemCategoryModel = new ItemCategoryModel(!empty($selectedCategoryId) ? $selectedCategoryId : 0);
         $itemsCategoryMenuView = new ItemsCategoryMenuView($itemCategoryModel, $this->categories_count_array, $this->config, false);
         $this->addParam('itemsCategoryMenuView', $itemsCategoryMenuView);
     }
     //selected category properties
     $propertiesViews = array();
     if (isset($selectedCategoryId) && $this->categoryManager->getCategoryById($selectedCategoryId)->getLastClickable() == '1') {
         $propertiesHierarchyDtos = $this->categoryHierarchyManager->getCategoryChildren($selectedCategoryId);
         foreach ($propertiesHierarchyDtos as $propertyHierarchyDto) {
             $propertyView = new CategoryPropertyView($this->categoryManager, $this->categoryHierarchyManager, $this->categories_count_array, $propertyHierarchyDto->getChildId(), $selected_category_property_ids);
             $propertiesViews[] = $propertyView;
         }
     }
     $this->addParam("properties_views", $propertiesViews);
     $this->addParam('category_id', $selectedCategoryId);
     $this->addParam('category_dto', $selectedCategoryDto);
     if ($selectedCategoryId > 0) {
         $categoryFullPath = $this->categoryManager->getCategoryFullPath($selectedCategoryId);
         if (count($categoryFullPath) >= 1) {
             $this->addParam('category_path', $categoryFullPath);
             $this->addParam('itemSearchManager', ItemSearchManager::getInstance($this->config, $this->args));
         }
     }
 }
Пример #13
0
 /**
  *
  * returns [   catname1=>[subcat1, subcat2,...],catname2=>[subcat1, subcat2,...]   ]
  */
 public function getItemProperties($item_id)
 {
     $categoryHierarchyManager = CategoryHierarchyManager::getInstance($this->config, $this->args);
     $ids_after_last_clickable = $this->getItemCategoriesArrayUnderLastClickableCategory($item_id);
     $cathDtos = $categoryHierarchyManager->getCategoriesByCatsAndChildsIds($ids_after_last_clickable, $ids_after_last_clickable);
     $catNames = $this->getCategoriesNamesArrayByIdsArray($ids_after_last_clickable);
     $ret = array();
     $pid = null;
     foreach ($cathDtos as $i => $cathDto) {
         if ($pid != $cathDto->getCategoryId()) {
             $ret[$catNames[$cathDto->getCategoryId()]] = array();
             $ret[$catNames[$cathDto->getCategoryId()]][] = $catNames[$cathDto->getChildId()];
             $pid = $cathDto->getCategoryId();
         } else {
             $ret[$catNames[$cathDto->getCategoryId()]][] = $catNames[$cathDto->getChildId()];
         }
     }
     return $ret;
 }