Magento – Getting Wrong Maximum Price For Configurable Products

magento-1.9price

I am trying to get final price for price slider but it is showing me wrong price.
See below images, Price should be 4000/- for right slider but it is showing me 2000.

Input Price–
enter image description here

Output Price–
enter image description here

Any Help Appreciated.

Code Where I get Maximum Price-

public function getCurrMaxPrice(){
    if($this->_currMaxPrice > 0)
    {
        $max = $this->_currMaxPrice;
    } else
    {
     $max = $this->_maxPrice;
    }

 $max;
    return $max;
}

Best Answer

simple add this function in your price model

public function getPrices()
    {  
          $collection = $this->getLayer()->getProductCollection();

         $data[]=array('from' =>$collection->getMinPrice(),
            'to' =>$collection->getMaxPrice());
         return $data;
    }

in your price block

get them like that

public function getPrices()
{                          
     return Mage::getModel($this->_filterModelName)->getPrices();
}

this will give maximum and minimum price for recent collection

this is model core class

Mage/Catalog/Model/Layer/Filter/Price.php

core block price

Mage/Catalog/Block/Layer/Filter/Price.php

Don't change in core files if you want to change them copy in app/code/local

Related Topic