cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.2.2 broken sorting

SOLVED

Magento 2.2.2 broken sorting

I updated Magento from 2.1 to 2.2.2 and now all product positions set in admin panel in category product list wont work correctly. (I checked in SQL that all position values setted by me is correct)

As I can see all products in categories now sorted by id from highest to lowest id.

Sorting  by name absolutely don't work, sort by position - similarly.

Works only sorting by price

Indexer:reindex doesn't help at all.

Where should I look for the problem? (Where is placed php/scripts responsible for sorting in categories?)

3 REPLIES

Re: Magento 2.2.2 broken sorting

Idk how and why because I have not yet fully studied the interaction of all the files listed in this message but the problem was in custom catalog_category_view.xml.

I change in this file layout from 2columns-left to 1column and remove the additional sidebar (which in its turn contains three blocks with Magento/CMS/Block/Block classes) by adding 

<referenceContainer name="sidebar.additional" remove="true" >. And thats broke category sorting. When i returned sidebar back all works fine.

Now I find easiest solve for this problem: I use category Design XML Layout update and set it to 1column. All works as it should work.

Maybe this topic can help for anyone who will face the same problem

Also always check admin panel functions before changing the code =)

Re: Magento 2.2.2 broken sorting

For me your solution did not work. Mine is do to moving layered navigation module before the product list. To fix I'm moving the layered navigation somewhere else. Here is the issue tracked on github: https://github.com/magento/magento2/issues/7253

Re: Magento 2.2.2 broken sorting

Hello,

I trying to debug issue and found extract issue when I print category collection query in list.phtml :

 

Query : ORDER BY `e`.`entity_id` DESC, `e`.`name` DESC LIMIT 9 so product sort according to entity_id;

Query Should be like this:  ORDER BY `e`.`name`, `e`.`entity_id` DESC, DESC LIMIT 9