If you need to change the Price Range in your Magento catalog go to:
app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php
Look for the line:
$range = pow(10, (strlen(floor($maxPrice))-$index));
Code language: PHP (php)
Change the 10 for a lower / higher number.
Please notice you're editing a Magento Core file.
You will lose the changes if you ever upgrade. You should create the same folder structure and override the file but within the /app/local folder (is there an other way?).
From the Admin
You can also edit the price range from the Admin:
1. Go to System > Configuration > Catalog (under Catalog) > Layered Navigation
2. Change the Price Navigation Step Calculation dropdown from Automatic to Manual
3. Enter the amount you want it to be (e.g. - 50) into the Default Price Navigation Step input box
4. Save
Surya
I want price ranges like this:
• Dresses under $100
• Between $100-$200
• Between $200-$300
• Between $300-$400
• Between $400-$500
• Dresses Over $500
If you have any solution please send me answer on my mail also
Rick
Have you tried the code above?
Change the 10 and check what it prints.
Regards
DEBO Jurgen
Backend->Menu->Catalog->Manage Categories
Select Your category Dresses on left pane
Select TAB, Display settings.
Layered Navigation Price Step
Uncheck Use Config Settings
Set the step You want.
shuja
I want to change the price range like this
Under $2,000
$2,000 – $10,000
$10,000 – $30,000
Over $30,000
any suggestion
Rick
Hi Shuja,
I don’t think it’s posible with the code above.
Cheers,
eduardo
Hi Shuja,
I have exactly the same isue have you solve it?
i know that i have to change the price.php at the model/layer/filter but i srugle to make it work.
aurelien
hello
same issue here too (as Shuja and eduardo)
did anyone found a solution?
thx
Rick
Hi aurelien,
Have you tried the following?
1. Go to Admin > System > Configuration > Catalog (under Catalog) > Layered Navigation.
2. Change the Price Navigation Step Calculation dropdown from Automatic to Manual.
3. Enter the amount you want it to be (e.g. – 50) into the Default Price Navigation Step input box .
4. Save
Cheers,
Rick
aurelien
hello
yes, I already saw this option
but it generates a fix-value ranges (0-50, 50-100, 100-150, …)
as Shuja mentionned, my need is to have custom price ranges (0-100, 100-500, 500-2000, …)
Rick
I’ve found this thread, there’s a lot of code in there. Give it a shot:
http://www.magentocommerce.com/boards/viewthread/10213
If you find an easy solution, feel free to come back and post it for the rest 😉
Good luck!
eduardo
Hi,
I solve it coping Price.php to Local->Mage->Catalog->Model->Layer->Filter->Price.php
then I added an if to the products biger than 10000000 (my products with out prise have a big numbers )
/** * Get data for build price filter items * * @return array */ protected function _getItemsData() { if (Mage::app()->getStore()->getConfig(self::XML_PATH_RANGE_CALCULATION) == self::RANGE_CALCULATION_IMPROVED) { return $this->_getCalculatedItemsData(); } elseif ($this->getInterval()) { return array(); } $range = $this->getPriceRange(); $dbRanges = $this->getRangeItemCounts($range); $data = array(); if (!empty($dbRanges)) { $lastIndex = array_keys($dbRanges); $lastIndex = $lastIndex[count($lastIndex) – 1]; foreach ($dbRanges as $index => $count) { $fromPrice = ($index == 1) ? " : (($index – 1) * $range); $toPrice = ($index == $lastIndex) ? " : ($index * $range); //EGS if toPrice is more than 20 the 20 if ($fromPrice >= 1000000.1) { $data[] = array( 'label' => 'Enquire', 'value' => $fromPrice . '-' . $toPrice, 'count' => $count, ); } else { $data[] = array( 'label' => $this->_renderRangeLabel($fromPrice, $toPrice), 'value' => $fromPrice . '-' . $toPrice, 'count' => $count, ); } } } return $data; }
Hope this help someone,
saludos
Rick
Awesome, thanks for sharing.
One thing, though… Where are the price ranges?
It looks like it gets them from the DataBase, right?
$range = $this->getPriceRange();
eduardo
Hi,
the code i added it is just to group the products that are more than a fix value thats all.
The ranges come from the admin. Magento (at least 1.7) gives you the posibility to add fix ranges or avarages ragens or even category ranges from the admin.
My problem was that what my customer wanted was not to show prices of more than 20000.
aurelien
hello
I made my own solution months ago, just after posting here
just posted it on GitHub: https://github.com/DiaFR/MagentoCustomizePriceFilter
nikhil
Thanks
Akash
Hello,
https://github.com/DiaFR/MagentoCustomizePriceFilter
There is no code on this link, can you please give me.
Thanks