Exemplo n.º 1
0
 public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
 {
     $filter = (int) $request->getParam($this->getRequestVar());
     if (!$filter) {
         return $this;
     }
     $this->_categoryId = $filter;
     Mage::register('current_category_filter', $this->getCategory(), true);
     $this->_appliedCategory = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getStore()->getId())->load($filter);
     if ($this->_isValidCategory($this->_appliedCategory)) {
         $this->getLayer()->getProductCollection()->addCategoryFilter($this->_appliedCategory);
         if (!self::$_appliedState) {
             $this->getLayer()->getState()->addFilter($this->_createItem($this->_appliedCategory->getName(), $filter));
         }
         self::$_appliedState = TRUE;
     }
     return $this;
 }
Exemplo n.º 2
0
 public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
 {
     $filter = $request->getParam($this->getRequestVar());
     if (!$filter) {
         $this->setCategories(array());
         return $this;
     }
     $categories = explode(',', $filter);
     $this->setCategories($categories);
     if (!self::$_appliedState) {
         if (count($categories) == 1) {
             $this->_applySingle($filter);
         } else {
             $this->_applyMultiple($categories);
         }
         self::$_appliedState = true;
     }
     return $this;
 }