/** * 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) { if (!$this->calculateRanges()) { $this->_items = array($this->_createItem('', 0, 0)); } $filterBlock->setValueFrom(Mage::helper('amshopby')->__('From')); $filterBlock->setValueTo(Mage::helper('amshopby')->__('To')); $input = $request->getParam($this->getRequestVar()); $fromTo = $this->_parseRequestedValue($input); if (is_null($fromTo)) { return $this; } list($from, $to) = $fromTo; $attributeCode = $this->getAttributeModel()->getAttributeCode(); /** @var Amasty_Shopby_Helper_Attributes $attributeHelper */ $attributeHelper = Mage::helper('amshopby/attributes'); if ($attributeHelper->lockApplyFilter($attributeCode, 'attr')) { $this->_getResource()->applyFilterToCollection($this, $from, $to); $this->getLayer()->getState()->addFilter($this->_createItem($this->_renderItemLabel($from, $to, true), $input)); } $filterBlock->setValueFrom($from > 0 ? $from : ''); $filterBlock->setValueTo($to > 0 ? $to : ''); if ($this->hideAfterSelection()) { $this->_items = array(); } elseif ($this->calculateRanges()) { $this->_items = array($this->_createItem('', 0, 0)); } return $this; }
/** * 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) { if (!$this->calculateRanges()) { $this->_items = array($this->_createItem('', 0, 0)); } $filterBlock->setValueFrom(Mage::helper('amshopby')->__('From')); $filterBlock->setValueTo(Mage::helper('amshopby')->__('To')); /** * Filter must be string: $index, $range */ $filter = $request->getParam($this->getRequestVar()); if (!$filter) { return $this; } $isFromTo = false; $range = array(); /* * Try range */ $range = explode($this->_rangeSeparator, $filter); if (count($range) != 2) { /* * Try from to */ $range = explode($this->_fromToSeparator, $filter); if (count($range) == 2) { $isFromTo = true; } else { return $this; } } list($from, $to) = $range; $from = floatval($from); $to = floatval($to); if ($from || $to) { if (!$isFromTo) { $index = $from; $range = $to; $from = ($index - 1) * $range; $to = $index * $range; } $this->_getResource()->applyFilterToCollection($this, $from, $to); $filterBlock->setValueFrom($from); if ($to > 0) { $filterBlock->setValueTo($to); } else { $filterBlock->setValueTo(''); } $this->getLayer()->getState()->addFilter($this->_createItem($this->_renderItemLabel($from, $to, true), $filter)); if ($this->hideAfterSelection()) { $this->_items = array(); } elseif ($this->calculateRanges()) { $this->_items = array($this->_createItem('', 0, 0)); } } return $this; }
public function __construct() { parent::__construct(); if (Mage::getStoreConfig('layerednavigationajax/layerfiler_config/enabled')) { $this->setTemplate('magentothem/layerednavigationajax/attribute.phtml'); } }
public function __construct() { parent::__construct(); $this->setTemplate('dmc_solr/catalog/layer/filter.phtml'); $this->_filterModelName = 'solr/catalog_layer_filter_decimal'; }
/** * Initialize Decimal Filter Model * */ public function __construct() { parent::__construct(); $this->setTemplate('vc_ajaxlayerednavigation/catalog/layer/filter.phtml'); }
/** * Initialize Decimal Filter Model * */ public function __construct() { parent::__construct(); $this->setTemplate('weltpixel/layerednavigation/catalog/layer/filter.phtml'); $this->_filterModelName = 'catalog/layer_filter_decimal'; }
/** * Initialize Decimal Filter Model * */ public function __construct() { parent::__construct(); $this->setTemplate('vc_priceslider/catalog/layer/filter.phtml'); }
/** * Initialize filter template * */ protected function _prepareFilter() { parent::_prepareFilter(); if (Mage::helper('gomage_navigation')->isGomageNavigation() && !Mage::registry('subdomain')) { switch ($this->getAttributeModel()->getFilterType()) { default: $this->_template = 'gomage/navigation/layer/filter/default.phtml'; break; case GoMage_Navigation_Model_Layer::FILTER_TYPE_INPUT: $this->_template = 'gomage/navigation/layer/filter/input.phtml'; break; case GoMage_Navigation_Model_Layer::FILTER_TYPE_SLIDER: $this->_template = 'gomage/navigation/layer/filter/slider.phtml'; break; case GoMage_Navigation_Model_Layer::FILTER_TYPE_SLIDER_INPUT: $this->_template = 'gomage/navigation/layer/filter/slider-input.phtml'; break; case GoMage_Navigation_Model_Layer::FILTER_TYPE_INPUT_SLIDER: $this->_template = 'gomage/navigation/layer/filter/input-slider.phtml'; break; case GoMage_Navigation_Model_Layer::FILTER_TYPE_DROPDOWN: $this->_template = 'gomage/navigation/layer/filter/dropdown.phtml'; break; } } }