Public Member Functions | |
__construct () | |
getResetValue () | |
apply (Zend_Controller_Request_Abstract $request, $filterBlock) | |
getName () | |
getCategory () | |
Protected Member Functions | |
_isValidCategory ($category) | |
Protected Attributes | |
$_categoryId | |
$_appliedCategory = null |
Definition at line 34 of file Category.php.
__construct | ( | ) |
Class constructor
Reimplemented from Varien_Object.
Definition at line 53 of file Category.php.
00054 { 00055 parent::__construct(); 00056 $this->_requestVar = 'cat'; 00057 }
_isValidCategory | ( | $ | category | ) | [protected] |
Validate category for be using as filter
Mage_Catalog_Model_Category | $category |
Definition at line 112 of file Category.php.
00113 { 00114 return $category->getId(); 00115 }
apply | ( | Zend_Controller_Request_Abstract $ | request, | |
$ | filterBlock | |||
) |
Apply category filter to layer
Zend_Controller_Request_Abstract | $request | |
Mage_Core_Block_Abstract | $filterBlock |
Reimplemented from Mage_Catalog_Model_Layer_Filter_Abstract.
Definition at line 86 of file Category.php.
00087 { 00088 $filter = (int) $request->getParam($this->getRequestVar()); 00089 $this->_categoryId = $filter; 00090 $this->_appliedCategory = Mage::getModel('catalog/category') 00091 ->setStoreId(Mage::app()->getStore()->getId()) 00092 ->load($filter); 00093 00094 if ($this->_isValidCategory($this->_appliedCategory)) { 00095 $this->getLayer()->getProductCollection() 00096 ->addCategoryFilter($this->_appliedCategory); 00097 00098 $this->getLayer()->getState()->addFilter( 00099 $this->_createItem($this->_appliedCategory->getName(), $filter) 00100 ); 00101 } 00102 00103 return $this; 00104 }
getCategory | ( | ) |
Get selected category object
Definition at line 132 of file Category.php.
00133 { 00134 if (!is_null($this->_categoryId)) { 00135 $category = Mage::getModel('catalog/category') 00136 ->load($this->_categoryId); 00137 if ($category->getId()) { 00138 return $category; 00139 } 00140 } 00141 return $this->getLayer()->getCurrentCategory(); 00142 }
getName | ( | ) |
Get filter name
Reimplemented from Mage_Catalog_Model_Layer_Filter_Abstract.
Definition at line 122 of file Category.php.
00123 { 00124 return Mage::helper('catalog')->__('Category'); 00125 }
getResetValue | ( | ) |
Get filter value for reset current filter state
Revert path ids
Reimplemented from Mage_Catalog_Model_Layer_Filter_Abstract.
Definition at line 64 of file Category.php.
00065 { 00066 if ($this->_appliedCategory) { 00067 /** 00068 * Revert path ids 00069 */ 00070 $pathIds = array_reverse($this->_appliedCategory->getPathIds()); 00071 $curCategoryId = $this->getLayer()->getCurrentCategory()->getId(); 00072 if (isset($pathIds[1]) && $pathIds[1] != $curCategoryId) { 00073 return $pathIds[1]; 00074 } 00075 } 00076 return null; 00077 }
$_appliedCategory = null [protected] |
Definition at line 48 of file Category.php.
$_categoryId [protected] |
Definition at line 41 of file Category.php.