0

We need to sort ordering on option values. for example Color is attribute and values are Red, Green, Blue then when we sort it should sort by alphabetically. So Blue, Green, Red results should come.

I hope you understand the problem. Default magento sort gives results based on option id not alphabetically.

Ref Issue:https://github.com/Smile-SA/elasticsuite/issues/450

asked Jan 23, 2019 at 8:18

1 Answer 1

0

EDIT; I think I misread.

If you wish to sort a product collection by an attribute then add this to the collection:

addAttributeToSort('attribute_code', 'desc')

If you're meaning that you wish for the options to be sorted alphabetically on the front end then you need to re-order them in the admin panel.

So click on stores in the sidebar and select 'product' under the attributes bit, select your 'colour' attribute and re-order them manually.

answered Jan 23, 2019 at 8:21
5
  • github.com/Smile-SA/elasticsuite/issues/450 Commented Jan 23, 2019 at 8:24
  • Ahh, I see - so the issue is outstanding and you wish to have a fix? I think might be a good idea to add to your main post. Commented Jan 23, 2019 at 8:27
  • main post mens? Commented Jan 23, 2019 at 8:29
  • sorry your original post - I can see you've added it now :) Commented Jan 23, 2019 at 8:31
  • @BAF, Will this sort the products with option values? How can i sort as like below only load Red on top and rest followed by it Commented Nov 27, 2019 at 6:01

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.