开发者

Magento: Sort by discount percentage with dropdown menu

开发者 https://www.devze.com 2023-03-15 22:18 出处:网络
I am new to Magento and am facing a problem. In my categories, I need to add a sort by opti开发者_如何学Con in the dropdown menu. So far it is easy, except that it is a discount percentage which is no

I am new to Magento and am facing a problem. In my categories, I need to add a sort by opti开发者_如何学Con in the dropdown menu. So far it is easy, except that it is a discount percentage which is not stored in the DB but the calculation of price and discount_price.

I found how to query with the calculation, I just don't know how to set the things together.

How to add a entry in the Dropdown menu? How to link that entry with a specific module (if needed)? What to override?

I am a bit confused and would really appreciate your inputs.

Edit

I have found a solution.

  • Created a module that overrides Mage_Catalog_Block_Product_List_Toolbar
  • Overrided setCollection method
  • Added fields to select via Zend ($collection->getSelect()->columns())
  • Created a new attribute in the backend whose keyword is the alias of our created field

That's pretty much it.


I have found a solution.

  • Created a module that overrides Mage_Catalog_Block_Product_List_Toolbar
  • Overrided setCollection method
  • Added fields to select via Zend ($collection->getSelect()->columns())
  • Created a new attribute in the backend which keyword is the alias of our created field

That's pretty much it.

0

精彩评论

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