Question

I added the new product sorting attribute related to price in category page like price low to high and price high to low. It showed on Sort By drop down. It is working fine for configurable product and simple product but the problem is, it is working grouped products case.

Grouped product shows the price of their lowest simple product price in category page.

For Reference please see the screenshot

enter image description here

For Reference I use code for price sorting

$collection->getSelect()->order("price_index.final_price asc");

Any help, experience and knowledge sharing would be appreciated.

Was it helpful?

Solution

I resolved this sorting problem by using minimal_price instead of price_index.final_price.

It will work for product types including simple, configurable and Grouped

Here is code for that

//For Descending order
$collection->getSelect()->order("minimal_price desc");

//For Ascending order
$collection->getSelect()->order("minimal_price asc");

I hope this will help others who are facing a similar kind of sorting problem in category page/product listing page.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top