1

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

1 Answer 1

1

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

1
  • What a shame! I don't have any idea it is as much easy. THanKs mate you are the savior. Commented Apr 25, 2019 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.