示例#1
0
 public function getShowSearch()
 {
     return parent::getShowSearch() && (!$this->getNumberOptionsForShowSearch() || $this->getNumberOptionsForShowSearch() <= count($this->getItemsAsArray()));
 }
 public function getItemsCount()
 {
     $v = Mage::app()->getRequest()->getParam($this->getRequestValue());
     if (isset($v) && $this->getRequestValue() == trim(Mage::getStoreConfig('amshopby/brands/attr'))) {
         $cat = Mage::registry('current_category');
         $rootId = (int) Mage::app()->getStore()->getRootCategoryId();
         if ($cat && $cat->getId() == $rootId) {
             // and this is not landing page
             $page = Mage::app()->getRequest()->getParam('am_landing');
             if (!$page) {
                 return 0;
             }
         }
     }
     $cnt = parent::getItemsCount();
     $showAll = !Mage::getStoreConfig('amshopby/general/hide_one_value');
     return $cnt > 1 || $showAll ? $cnt : 0;
 }
 public function getItemsCount()
 {
     $v = Mage::app()->getRequest()->getParam($this->getRequestValue());
     if (isset($v) && $this->getRequestValue() == trim(Mage::getStoreConfig('amshopby/brands/attr'))) {
         $cat = Mage::registry('current_category');
         $rootId = (int) Mage::app()->getStore()->getRootCategoryId();
         if ($cat && $cat->getId() == $rootId) {
             // and this is not landing page
             $page = Mage::app()->getRequest()->getParam('am_landing');
             if (!$page) {
                 return 0;
             }
         }
     }
     // Simulate native Filterable (no results) behavior
     $attr = $this->getAttributeModel();
     $filterableMode = $attr->getIsFilterable();
     if ($filterableMode == 2) {
         $anyPositive = false;
         foreach ($this->getItems() as $item) {
             /** @var Amasty_Shopby_Model_Catalog_Layer_Filter_Item $item */
             if ($item->getCount()) {
                 $anyPositive = true;
                 break;
             }
         }
         if (!$anyPositive) {
             return 0;
         }
     }
     $cnt = parent::getItemsCount();
     $showAll = !Mage::getStoreConfig('amshopby/general/hide_one_value');
     return $cnt > 1 || $showAll ? $cnt : 0;
 }