/** * Apply decimal range filter to product collection * * @param \Magento\Framework\App\RequestInterface $request * @return $this */ public function apply(\Magento\Framework\App\RequestInterface $request) { parent::apply($request); /** * Filter must be string: $index, $range */ $filter = $request->getParam($this->getRequestVar()); if (!$filter || is_array($filter)) { return $this; } $filter = explode(',', $filter); if (count($filter) != 2) { return $this; } list($index, $range) = $filter; if ((int) $index && (int) $range) { $this->dataProvider->setRange((int) $range); $this->dataProvider->getResource()->applyFilterToCollection($this, $range, $index); $this->getLayer()->getState()->addFilter($this->_createItem($this->_renderItemLabel($range, $index), $filter)); $this->_items = []; } return $this; }
/** * Apply decimal range filter to product collection * * @param \Zend_Controller_Request_Abstract $request * @return $this */ public function apply(\Zend_Controller_Request_Abstract $request) { parent::apply($request); /** * Filter must be string: $index, $range */ $filter = $request->getParam($this->getRequestVar()); if (!$filter || is_array($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; }