开发者

price filter problem in magento

开发者 https://www.devze.com 2023-01-14 20:57 出处:网络
In magento sidebar basically how the price filter option is working, i went through all the templte and block files under my custom design.

In magento sidebar basically how the price filter option is working, i went through all the templte and block files under my custom design.

开发者_JAVA技巧I am getting this ranges by default.

   1. $0.00 - $10,000.00  (1027)
   2. $10,000.00 - $20,000.00 (3)
   3. $20,000.00 - $30,000.00 (1)

These limits are automatically taken but i want give my own ranges, but they are using only one template file called filter.phtml if i touch that then all other filter options are having problem. How can i customize this price filter as per my own set of ranges?

I need something like this

 #  $40.00 - $60.00  (155)
# $60.00 - $80.00 (150)
# $80.00 - $100.00 (153)
# $100.00 - $200.00 (248)
# $200.00 - $300.00 (100)
# $300.00 - $400.00 (43)
# $400.00 - $500.00 (20)
# $500.00 - $600.00 (6)
# $600.00 - $700.00 (6)
# $700.00 - $800.00 (2)


If you look in filter.phtml, you will see that it is using the block Mage_Catalog_Block_Layer_Filter_xxx where xxx is the attribute type. Which in turn leads you to the model: Mage_Catalog_Model_Layer_Filter_Price.

Inside app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php, you will see the method getPriceRange() which calculates the price breaks.

You can override that model by copying it into app/code/local/Mage/Catalog/Model/Layer/Filter and adjusting that method so that it calculates the ranges per your requirements.

Good luck. JD

0

精彩评论

暂无评论...
验证码 换一张
取 消