How to change the price range in layered navigation in Magento?



Magento layered navigation is the great functionality and you can include any product attributes through the admin and the price range is the default layered functionality which is already included by the Magento. But it has own price range but in this post I am trying to describe how to change the price range in layered navigation in Magento. Here are the steps given below:

Step 1. Just navigate to the /app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php
Step 2. Open the file in your favorite editor and search for the getPriceRange() function and replace the code from the below code.

public function getPriceRange()
    {
        $range = $this->getData('price_range');
        if (is_null($range)) {
            $maxPrice = $this->getMaxPriceInt();
            $minPrice = $this->getMinPriceInt();
            $index = 1;
            do {
                $range = pow(10, (strlen(floor($maxPrice))-$index));
                $items = $this->getRangeItemCounts($range);
                $index++;
            }
            while($range>self::MIN_RANGE_POWER && count($items)<5);
            
            if((($range*5)>self::MIN_RANGE_POWER)&& (count($this->getRangeItemCounts($range*5))>5))
                $range = $range*5;
            if((($range*2)>self::MIN_RANGE_POWER)&& (count($this->getRangeItemCounts($range*2))>5))
                $range = $range*2;

            $this->setData('price_range', $range);
        }
        return $range;
    } 

Note : Please do not edit the core Magento code file you can put this file into the /app/code/local/Mage/Catalog/Model/Layer/Filter/Price.php and put the Magento core code file as it is.

Hope it helps, Thanks and enjoy the reading.