Frage

I used the following code for sorting on category page.

if($this->getCurrentOrder() =="latest_products")
    {
       $collection->addAttributeToSort('significance', 'DESC')->getSelect()->order("e.entity_id desc");
    }

In order to debug, I use following on my local instance but surprisingly there is no ORDER BY significance DESC in query as well

$collection->getSelect(); die;

This is my configuration settings

enter image description here

War es hilfreich?

Lösung

I faced similar kind of problem because I was working on category page product sorting. As I understand, you made custom product attribute significance for sorting. So please make you have set Used in Product Listing to Yes in your custom product attribute. It is one of the possible cause.

enter image description here

As I look your configuration setting, the reason is because you set the Use Flat Catalog Product to Yes. So you have to set Used in Product Listing to Yes.

I hope this will help

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top