Mage_Catalog_Block_Layer_View Class Reference

Inheritance diagram for Mage_Catalog_Block_Layer_View:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object Mage_CatalogSearch_Block_Layer

List of all members.

Public Member Functions

 getLayer ()
 getStateHtml ()
 getFilters ()
 canShowOptions ()
 canShowBlock ()

Protected Member Functions

 _prepareLayout ()
 _getFilterableAttributes ()
 _getCategoryFilter ()
 _getPriceFilter ()


Detailed Description

Definition at line 34 of file View.php.


Member Function Documentation

_getCategoryFilter (  )  [protected]

Get category filter block

Returns:
Mage_Catalog_Block_Layer_Filter_Category

Definition at line 131 of file View.php.

00132     {
00133         return $this->getChild('category_filter');
00134     }

_getFilterableAttributes (  )  [protected]

Get all fiterable attributes of current category

Returns:
array

Definition at line 86 of file View.php.

00087     {
00088         $attributes = $this->getData('_filterable_attributes');
00089         if (is_null($attributes)) {
00090             $attributes = $this->getLayer()->getFilterableAttributes();
00091             $this->setData('_filterable_attributes', $attributes);
00092         }
00093         return $attributes;
00094     }

_getPriceFilter (  )  [protected]

Retrieve Price Filter block

Returns:
Mage_Catalog_Block_Layer_Filter_Price

Definition at line 166 of file View.php.

00167     {
00168         return $this->getChild('_price_filter');
00169     }

_prepareLayout (  )  [protected]

Prepare child blocks

Returns:
Mage_Catalog_Block_Layer_View

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 41 of file View.php.

00042     {
00043         $stateBlock = $this->getLayout()->createBlock('catalog/layer_state')
00044             ->setLayer($this->getLayer());
00045 
00046         $categryBlock = $this->getLayout()->createBlock('catalog/layer_filter_category')
00047             ->setLayer($this->getLayer())
00048             ->init();
00049 
00050         $this->setChild('layer_state', $stateBlock);
00051         $this->setChild('category_filter', $categryBlock);
00052 
00053         $filterableAttributes = $this->_getFilterableAttributes();
00054         foreach ($filterableAttributes as $attribute) {
00055             $filterBlockName = 'catalog/layer_filter_attribute';
00056             if ($attribute->getFrontendInput() == 'price') {
00057                 $filterBlockName = 'catalog/layer_filter_price';
00058             }
00059 
00060             $this->setChild($attribute->getAttributeCode().'_filter',
00061                 $this->getLayout()->createBlock($filterBlockName)
00062                     ->setLayer($this->getLayer())
00063                     ->setAttributeModel($attribute)
00064                     ->init());
00065         }
00066 
00067         $this->getLayer()->apply();
00068         return parent::_prepareLayout();
00069     }

canShowBlock (  ) 

Check availability display layer block

Returns:
bool

Reimplemented in Mage_CatalogSearch_Block_Layer.

Definition at line 156 of file View.php.

00157     {
00158         return $this->canShowOptions() || count($this->getLayer()->getState()->getFilters());
00159     }

canShowOptions (  ) 

Check availability display layer options

Returns:
bool

Definition at line 141 of file View.php.

00142     {
00143         foreach ($this->getFilters() as $filter) {
00144             if ($filter->getItemsCount()) {
00145                 return true;
00146             }
00147         }
00148         return false;
00149     }

getFilters (  ) 

Get all layer filters

Returns:
array

Definition at line 111 of file View.php.

00112     {
00113         $filters = array();
00114         if ($categoryFilter = $this->_getCategoryFilter()) {
00115             $filters[] = $categoryFilter;
00116         }
00117 
00118         $filterableAttributes = $this->_getFilterableAttributes();
00119         foreach ($filterableAttributes as $attribute) {
00120             $filters[] = $this->getChild($attribute->getAttributeCode().'_filter');
00121         }
00122 
00123         return $filters;
00124     }

getLayer (  ) 

Get layer object

Returns:
Mage_Catalog_Model_Layer

Reimplemented in Mage_CatalogSearch_Block_Layer.

Definition at line 76 of file View.php.

00077     {
00078         return Mage::getSingleton('catalog/layer');
00079     }

getStateHtml (  ) 

Get layered navigation state html

Returns:
string

Definition at line 101 of file View.php.

00102     {
00103         return $this->getChildHtml('layer_state');
00104     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:36 2009 for Magento by  doxygen 1.5.8