/**
  * Apply price range filter to product collection
  *
  * @param Mage_Catalog_Model_Layer_Filter_Price $filter
  * @return Mage_Catalog_Model_Resource_Layer_Filter_Price
  */
 public function applyPriceRange($filter)
 {
     if (!Mage::helper('catalogfilter')->priceIsSlider()) {
         return parent::applyPriceRange($filter);
     }
     $interval = $filter->getInterval();
     if (!$interval) {
         return $this;
     }
     list($from, $to) = $interval;
     if ($from === '' && $to === '') {
         return $this;
     }
     $select = $filter->getLayer()->getProductCollection()->getSelect();
     $priceExpr = $this->_getPriceExpression($filter, $select, false);
     if ($to !== '') {
         $to = (double) $to;
         if ($from == $to) {
             $to += self::MIN_POSSIBLE_PRICE;
         }
     }
     if ($from !== '') {
         $select->where($priceExpr . ' >= ' . $this->_getComparingValue($from, $filter));
     }
     if ($to !== '') {
         $select->where($priceExpr . ' <= ' . $this->_getComparingValue($to, $filter, false));
     }
     return $this;
 }
Пример #2
0
 /**
  * Apply price range filter to product collection
  *
  * @param Mage_Catalog_Model_Layer_Filter_Price $filter
  * @return Mage_Catalog_Model_Resource_Layer_Filter_Price
  */
 public function applyPriceRange($filter)
 {
     if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
         return parent::applyPriceRange($filter);
     }
     $collection = $filter->getLayer()->getProductCollection();
     if (!method_exists($collection, 'checkSearchaniseResult') || !$collection->checkSearchaniseResult()) {
         return parent::applyPriceRange($filter);
     }
     // Disable internal price filter.
     return $this;
 }