Try our conversational search powered by Generative AI!

Sorting results of related products

Vote:
 

Hi,

I can't find the answer to this one anywhere. Related Entries appears to be an orderable list within the CMS but using GetRelatedEntries() returns an IEnumerable which of course is unordered. Is there a way I can find out the order of these that appears within commerce?

Thanks!

Ben

#187574
Jan 29, 2018 7:53
Vote:
 

Which GetRelatedEntries method are you refering to? :) Are you talking about relations/associations for catalog content?

Edit: Found it! I assume you're doing it on the content itself via (EntryContentBaseExtensions.GetRelatedEntries(this EntryContentBase entry)). That will give you the Associations of that catalog content. I would probably recommend using IAssociationsRepository instead, as the Association object has a SortOrder you can use to order the items.

#187575
Edited, Jan 29, 2018 8:11
Vote:
 

Thanks that fixed it! :)

#187615
Jan 30, 2018 0:11
Vote:
 

EntryContentBaseExtensions.GetRelatedEntries should probably return the links sorted by the sortorder of the associations, much like ProductContentExtensions.GetVariants etc does for relations. I'll log a bug for it.

#187636
Jan 30, 2018 14:35
Vote:
 

Fixed in Commerce 10.8.1!

https://world.episerver.com/documentation/Release-Notes/ReleaseNote/?releaseNoteId=COM-6388

#188108
Edited, Feb 12, 2018 14:58
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.