Public Member Functions | |
setRequestVar ($varName) | |
getRequestVar () | |
getResetValue () | |
apply (Zend_Controller_Request_Abstract $request, $filterBlock) | |
getItemsCount () | |
getItems () | |
getLayer () | |
setAttributeModel ($attribute) | |
getAttributeModel () | |
getName () | |
Protected Member Functions | |
_getItemsData () | |
_initItems () | |
_createItem ($label, $value, $count=0) | |
_getFilterEntityIds () | |
_getBaseCollectionSql () | |
Protected Attributes | |
$_requestVar | |
$_items |
Definition at line 34 of file Abstract.php.
_createItem | ( | $ | label, | |
$ | value, | |||
$ | count = 0 | |||
) | [protected] |
Create filter item object
string | $label | |
mixed | $value | |
int | $count |
Definition at line 178 of file Abstract.php.
00179 { 00180 return Mage::getModel('catalog/layer_filter_item') 00181 ->setFilter($this) 00182 ->setLabel($label) 00183 ->setValue($value) 00184 ->setCount($count); 00185 }
_getBaseCollectionSql | ( | ) | [protected] |
Get product collection select object with applied filters
Definition at line 202 of file Abstract.php.
00203 { 00204 return $this->getLayer()->getProductCollection()->getSelect(); 00205 }
_getFilterEntityIds | ( | ) | [protected] |
Get all product ids from from collection with applied filters
Definition at line 192 of file Abstract.php.
00193 { 00194 return $this->getLayer()->getProductCollection()->getAllIdsCache(); 00195 }
_getItemsData | ( | ) | [protected] |
Get data array for building filter items
result array should have next structure: array( $index => array( 'label' => $label, 'value' => $value, 'count' => $count ) )
Reimplemented in Mage_Catalog_Model_Layer_Filter_Attribute, and Mage_Catalog_Model_Layer_Filter_Price.
Definition at line 129 of file Abstract.php.
00130 { 00131 return array(); 00132 }
_initItems | ( | ) | [protected] |
Initialize filter items
Definition at line 139 of file Abstract.php.
00140 { 00141 $data = $this->_getItemsData(); 00142 $items=array(); 00143 foreach ($data as $itemData) { 00144 $items[] = $this->_createItem( 00145 $itemData['label'], 00146 $itemData['value'], 00147 $itemData['count'] 00148 ); 00149 } 00150 $this->_items = $items; 00151 return $this; 00152 }
apply | ( | Zend_Controller_Request_Abstract $ | request, | |
$ | filterBlock | |||
) |
Apply filter to collection
Zend_Controller_Request_Abstract | $request |
Reimplemented in Mage_Catalog_Model_Layer_Filter_Attribute, Mage_Catalog_Model_Layer_Filter_Category, and Mage_Catalog_Model_Layer_Filter_Price.
Definition at line 87 of file Abstract.php.
getAttributeModel | ( | ) |
Get attribute model associated with filter
Definition at line 225 of file Abstract.php.
00226 { 00227 $attribute = $this->getData('attribute_model'); 00228 if (is_null($attribute)) { 00229 Mage::throwException(Mage::helper('catalog')->__('Attribute model not defined')); 00230 } 00231 return $attribute; 00232 }
getItems | ( | ) |
Get all filter items
Definition at line 107 of file Abstract.php.
00108 { 00109 if (is_null($this->_items)) { 00110 $this->_initItems(); 00111 } 00112 return $this->_items; 00113 }
getItemsCount | ( | ) |
Get fiter items count
Definition at line 97 of file Abstract.php.
00098 { 00099 return count($this->getItems()); 00100 }
getLayer | ( | ) |
Retrieve layer object
Definition at line 160 of file Abstract.php.
00161 { 00162 $layer = $this->_getData('layer'); 00163 if (is_null($layer)) { 00164 $layer = Mage::getSingleton('catalog/layer'); 00165 $this->setData('layer', $layer); 00166 } 00167 return $layer; 00168 }
getName | ( | ) |
Get filter text label
Reimplemented in Mage_Catalog_Model_Layer_Filter_Category.
Definition at line 239 of file Abstract.php.
00240 { 00241 return $this->getAttributeModel()->getFrontendLabel(); 00242 }
getRequestVar | ( | ) |
Get request variable name which is used for apply filter
Definition at line 67 of file Abstract.php.
getResetValue | ( | ) |
Get filter value for reset current filter state
Reimplemented in Mage_Catalog_Model_Layer_Filter_Category.
Definition at line 77 of file Abstract.php.
setAttributeModel | ( | $ | attribute | ) |
Set attribute model to filter
Mage_Eav_Model_Entity_Attribute | $attribute |
Definition at line 213 of file Abstract.php.
00214 { 00215 $this->setRequestVar($attribute->getAttributeCode()); 00216 $this->setData('attribute_model', $attribute); 00217 return $this; 00218 }
setRequestVar | ( | $ | varName | ) |
Set request variable name which is used for apply filter
string | $varName |
Definition at line 56 of file Abstract.php.
$_items [protected] |
Definition at line 48 of file Abstract.php.
$_requestVar [protected] |
Definition at line 41 of file Abstract.php.