cancel
Showing results for 
Search instead for 
Did you mean: 

Product sort order not working

Product sort order not working

Using Magento ver. 2.2.5

I am using the blank theme.

By default my products are being displayed with the sort order of product ID, descending, as far as I can see, a sort order as useless as it is nonsensical. I want to display products for a given category in an arbitrary order. So I created an attribute "display order", validated as an integer and added that attribute to my products. I set the values to 100, 200, 300, etc. according to the order in which I want the products displayed. I set the value of "Used for sorting in product listing" to Yes.

For the scope of the product sub-category concerned, but also for the root category, I select that attribute for both "Available product listing sort by" and "Default product listing sort by". I clean the cache on the server and clear the browser cache.

These settings are ignored and the products are still listed in the same, useless way.
So what is the problem? Does the theme not support this method? Is there a bug? Have I missed something in the configuration? Do I need to add custom code?

11 REPLIES 11

Re: Product sort order not working

I'm experiencing a similar issue here.

 

I simply have too many products to deal with setting each and every position key by hand. I tried a similar method with using a custom attribute and importing en-masse my preferred sort order only to find that Magento is ignoring this and setting all position keys to 1.

 

The only idea I have at the moment is custom code that will match sku to product ID (since product ID can't be exported), grab the sort attribute from my data file and set the position key for specified (incoming) product in catalog_category_product_index during re-import.

Re: Product sort order not working

I can confirm successfully sorting by converting my custom sort key to the Magento native position key via mass update by first exporting the sku with entity_id from magento.category_product_entity

 

Then, matching up the skus with my original product import sheet that contains my preferred sort order key, via the skus in these two files, I joined the entity_id to the product_id in magento.catalog_category_product_index and set the position key there where applicable using my custom sort key for no more sorting issues.

 

 

 

Re: Product sort order not working

section named as "Products in Category". See attached screen shot:
 ans.png
Here you can see one column in right, where you can set Position of products.
 
This "Position" attribute also fall into sorting parameters. You can see it in above mentioned screen shot.
 
Once you set position, you can see the sorting of products by using "Position" parameter.
sort-option.png
 
Problem solved? Click Kudos & Accept as Solution!

Re: Product sort order not working

That is precisely what does NOT work.

Re: Product sort order not working

Hi @josiah_carberry,

 

I checked on Magento 2.2.5 version and found that position sort order working here. Sharing few screens shot here.

When I did not change anything in position orders from back-end then my products listing showing like this:

sort2.png

 

After this, I made changes in position order from back-end like attached screen shot:

sort1.png

Making above mentioned changed in position, products listing is showing like this.

sort3.png

Let me know if you are still facing any issues in it.

Re: Product sort order not working

I am using version 2.2.5 and that solution did NOT solve the problem for me.  Here are the screen shots that show it is not working:

 

I set the position number:

 

1.jpg

 

Then set the "Sort By" to "Position":

3.jpg

 

Save and flush the cache.  But the home page product listing is still not sorted by position:

 

2.jpg

Re: Product sort order not working

Hi @johnhall6095

 

Unfortunately, I am not able to see uploaded images. May you please share them again. So that I can check.

Re: Product sort order not working

Have you already done the reindexing?

Re: Product sort order not working

Hi @johnhall6095

 

Yes, you can do re-indexing too but I think if it is on home page and not working according to the sorting than it could be the coding issue.

 

Check one thing, go to the product listing page of that category and check there that sorting is working or not. Because, on product listing page this sorting should work according to the default functionality. But on home page, it could possible that we do not have coding for sorting.

 

If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"