Exemplo n.º 1
0
 public function index()
 {
     $category = Category::getInstanceByID($this->request->get('id'), Category::LOAD_DATA);
     $types = ProductRatingType::getCategoryRatingTypes($category)->toArray();
     $response = new ActionResponse('typeList', $types);
     $response->set('form', $this->buildForm());
     $response->set('id', $this->request->get('id'));
     return $response;
 }
Exemplo n.º 2
0
 private function getTabCounts($categoryId)
 {
     ClassLoader::import('application.model.category.*');
     ClassLoader::import('application.model.filter.*');
     ClassLoader::import('application.model.product.*');
     $category = Category::getInstanceByID($categoryId, Category::LOAD_DATA);
     $reviewCond = new EqualsOrMoreCond(new ARFieldHandle('Category', 'lft'), $category->lft->get());
     $reviewCond->addAND(new EqualsOrLessCond(new ARFieldHandle('Category', 'rgt'), $category->rgt->get()));
     return array('tabProducts' => $category->totalProductCount->get(), 'tabFilters' => $this->getFilterCount($category), 'tabFields' => $this->getSpecFieldCount($category), 'tabImages' => $this->getCategoryImageCount($category), 'tabOptions' => $category->getOptions()->getTotalRecordCount(), 'tabRatingCategories' => ProductRatingType::getCategoryRatingTypes($category)->size(), 'tabReviews' => ActiveRecordModel::getRecordCount('ProductReview', new ARSelectFilter($reviewCond), array('Category', 'Product')), 'tabProductLists' => $category->getRelatedRecordCount('ProductList'));
 }