コード例 #1
0
 /**
  * This method in Mage_Catalog_Model_Layer_Filter_Category would ensure when a category filter is remove, the parent
  * category is applied as a filter. This isn't expected functionality for Klevu, and has been reset to a null value.
  * @return null
  */
 public function getResetValue()
 {
     if (!Mage::helper('klevu_search/config')->isExtensionConfigured() || !Mage::helper('klevu_search')->isCatalogSearch()) {
         return parent::getResetValue();
     }
     return null;
 }
コード例 #2
0
ファイル: CategoryTest.php プロジェクト: natxetee/magento2
 /**
  * @depends testApply
  */
 public function testGetResetValueApplied(Mage_Catalog_Model_Layer_Filter_Category $modelApplied)
 {
     $this->assertEquals(2, $modelApplied->getResetValue());
 }
コード例 #3
0
 /**
  * do not show the level 2 items if the tree category listing is selected
  */
 public function getResetValue()
 {
     if ($this->_layeredHelper->getCategoryDisplay() != 2) {
         //tree listing
         parent::getResetValue();
     } else {
         if ($this->_appliedCategory) {
             /**
              * Revert path ids
              */
             $pathIds = array_reverse($this->_appliedCategory->getPathIds());
             $curCategoryId = $this->getLayer()->getCurrentCategory()->getId();
             if (Mage::getModel('catalog/category')->load($curCategoryId)->getLevel() == 2) {
                 return null;
             }
             if (isset($pathIds[1]) && $pathIds[1] != $curCategoryId) {
                 return $pathIds[1];
             }
         }
         return null;
     }
 }