/** * Shop display product tool page */ public function dispShopToolManageProducts(){ $module_srl = $this->module_info->module_srl; $args = new stdClass(); $args->module_srl = $module_srl; if ($search = Context::get('search')) { $col = (Context::get('column') ? Context::get('column') : 'title'); $args->$col = $search; } if ($cat_srl = Context::get('category_srl')) { if (!is_numeric($cat_srl)) throw new ShopException('invalid category srl'); $cat = new Category($cat_srl); Context::set('filterCategory', $cat); $args->category_srls = array($cat_srl); } if ($page = Context::get('page')) $args->page = $page; Context::set('column_filters', array('title', 'description')); $pRepo = new ProductRepository(); $output = $pRepo->getProductList($args); Context::set('product_list', $output->products); Context::set('page_navigation', $output->page_navigation); $category_repository = new CategoryRepository(); $tree = $category_repository->getCategoriesTree($module_srl); $flat_tree = $tree->toFlatStructure(); Context::set('productsCount', $pRepo->count('countProducts', array('module_srl' => $module_srl))); Context::set('category_list', $flat_tree); }