Try our conversational search powered by Generative AI!

Default Sorting Order of Products in category - Using the CMS UI

Vote:
 

On our product list pages the products returned seem to be in the order they were published.

Our normal sortng seems to work fine. 

case SortingType.Price:
search = search.OrderBy(p => p.SearchPrice());
break;
case SortingType.PriceReverse:
search = search.OrderByDescending(p => p.SearchPrice());
break;
case SortingType.TopRated:
search = search.OrderByDescending(p => p.AverageRating)
.ThenByDescending(p => p.ReviewCount);

We need the products to be returned in the order they appear in the CMS editor so that the content editors can visuall see and sort the products.

EPiServer Commerce Framework 
Version: 11.8 (build: 2)

Kind Regards

Sandeep

#197745
Edited, Oct 12, 2018 1:53
Vote:
 

Sandeep, i am not sure I understand your question. So you want to show the products to the end users in the same order as they are shown to the editors?

#197760
Oct 12, 2018 8:04
Vote:
 

Yes please

#197762
Oct 12, 2018 8:22
Vote:
 

The products are sorted by the SortOrder to their respective category, so it is not a property in the products itself. This is a tricky problem I must admit - not sure I have good solution. You can of course writing a Sort method that loads the relations of the product, gets the sort order in the current category and then sorts by it. But it is not that elegant or simple ... 

#197771
Oct 12, 2018 9:38
Vote:
 

Wanted to know that when indexing the products in EPi find it must insert it in the order they appear in the CMS I am presume.

Also could you please confirm that if no sorting is specified in the qury paramet what criteria does it use to return product. Is it by the latest publish date.

#197772
Oct 12, 2018 10:00
Vote:
 

To get Node/Entry sortOrder

var nodeEntryRelations = _relationRepository.GetParents<NodeEntryRelation>([EntryContentLink]);
var relation = nodeEntryRelations.FirstOrDefault(r => r.Parent == [NodeContentLink]);

var sortOrder = relation.SortOrder;

#207101
Sep 10, 2019 13:06
* 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.