Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » User defined sorting of Ecom groups in frontend

User defined sorting of Ecom groups in frontend

Martin Christensen


I've encountered that the sorting of Ecom groups in frontend is no longer reflective of the manual sorting in backend. Instead, groups are displayed alphabetically in the group list of the product catalog app. I've asked support about this and been told that this is the default behaviour from 9.9 and onwards.

Is there any workaround? The API for the group class doesn't seem to provide a property that holds the manual sort order.

We have a customer for whom this is pretty criticial, so we've made a quickfix adding a custom sort order field to the groups that we can sort by. But it's pretty tedious to maintain.


Best regards

Martin Christensen


Nicolai Pedersen

Hi Martin

Where are you in your code...? Can we see the context - is it a template, api call ?

The group class does not have a sort order since a group can be many times in the tree and have different sort order. So the sortorder for is on the group relation and not the group it self.


Martin Christensen

Sure, I'm working with the grouplist template for the product catalog app, ie. Ecom/GroupList/grouplist.cshtml

This is my current workaround - just sorting by group number, which I've then modified to reflect the desired order - not very maintainable:

@foreach(LoopItem g in GetLoop("Groups").OrderBy(o=>o.GetInteger("Ecom:Group.Number")).ToList()){
//show some groups

I could also do something like this:

var groups = Dynamicweb.Ecommerce.Services.ProductGroups.GetToplevelGroups().ToList();
groups.OrderBy(x => x.SomeParameter); sort by any property of the Group class. Although I wouldn't necessarily want to display all toplevel groups.

Roald Haahr


I am just facing the same problem.

It would be helpful if the LoopItems produced by GetLoop("Groups") had a sort score property that reflected the sort score in the context. If, say, I have created a 'Product Catalog (Ecom)'-App and selected that it should show all top groups in a shop, then the sort score should be that of the Group/Shop relation.

For now, I'll be using the group number workaround.

Kind regards,
Roald, Novicell


You must be logged in to post in the forum