Exemplo n.º 1
0
 /**
  * Return unique filter name. 
  * OO purists would say that kind of ifs should be done using virtual functions. Here we ignore OO-ness and 
  * micro performance penalty for the sake of clarity and keeping logic in one file.
  * @param Mage_Catalog_Model_Layer_Filter_Abstract $model
  * @return string
  */
 public function getFilterName($model)
 {
     if ($model instanceof Mana_Filters_Model_Filter_Category) {
         return 'category';
     } else {
         return $model->getAttributeModel()->getAttributeCode();
     }
 }
Exemplo n.º 2
0
 /**
  * Return unique filter name. 
  * OO purists would say that kind of ifs should be done using virtual functions. Here we ignore OO-ness and 
  * micro performance penalty for the sake of clarity and keeping logic in one file.
  * @param Mage_Catalog_Model_Layer_Filter_Abstract $model
  * @return string
  */
 public function getFilterName($block, $model)
 {
     if ($model instanceof Morphes_Filters_Model_Filter_Category) {
         $result = 'category';
     } else {
         $result = $model->getAttributeModel()->getAttributeCode();
     }
     if ($showInFilter = $block->getShowInFilter()) {
         return $showInFilter . '_' . $result;
     } else {
         return $result;
     }
 }
Exemplo n.º 3
0
 /**
  * Apply decimal range filter to product collection
  *
  * @param Zend_Controller_Request_Abstract $request
  * @param Mage_Catalog_Block_Layer_Filter_Decimal $filterBlock
  * @return Mage_Catalog_Model_Layer_Filter_Decimal
  */
 public function apply(Zend_Controller_Request_Abstract $request, $filterBlock)
 {
     parent::apply($request, $filterBlock);
     /**
      * Filter must be string: $index, $range
      */
     $filter = $request->getParam($this->getRequestVar());
     if (!$filter) {
         return $this;
     }
     $filter = explode(',', $filter);
     if (count($filter) != 2) {
         return $this;
     }
     list($index, $range) = $filter;
     if ((int) $index && (int) $range) {
         $this->setRange((int) $range);
         $this->_getResource()->applyFilterToCollection($this, $range, $index);
         $this->getLayer()->getState()->addFilter($this->_createItem($this->_renderItemLabel($range, $index), $filter));
         $this->_items = array();
     }
     return $this;
 }
 /**
  * Construct attribute filter
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->_requestVar = 'attribute';
 }
Exemplo n.º 5
0
 /**
  * Get 'clear price' link text
  *
  * @return false|string
  */
 public function getClearLinkText()
 {
     if (Mage::app()->getStore()->getConfig(self::XML_PATH_RANGE_CALCULATION) == self::RANGE_CALCULATION_IMPROVED && $this->getPriorIntervals()) {
         return Mage::helper('catalog')->__('Clear Price');
     }
     return parent::getClearLinkText();
 }
Exemplo n.º 6
0
 public function _construct()
 {
     parent::_construct();
     $this->_requestVar = 'discount';
 }
Exemplo n.º 7
0
 public function __construct()
 {
     parent::__construct();
     $this->_requestVar = 'cat';
 }
Exemplo n.º 8
0
 /**
  * @param Mage_Catalog_Model_Layer_Filter_Abstract $filter
  * @return bool
  */
 public function isAttributeFilter(Mage_Catalog_Model_Layer_Filter_Abstract $filter)
 {
     return $filter instanceof Mage_Catalog_Model_Layer_Filter_Attribute && !$filter->getAttributeModel()->getSource() instanceof Mage_Eav_Model_Entity_Attribute_Source_Boolean;
 }