Developer forum

Forum » Ecommerce - Standard features » Sort products when viewing Parent group

Sort products when viewing Parent group

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a situation where a Parent group has a few subgroups.

When I access the parent group, I get all products from all subgroups but I cannot figure the sorting.

Assuming that I have ParentGroup with Subgroup1, Subgroup2, Subgroup3, I would expect to see first the products from Subgroup1, then the products from Subgroup2 and so on.

Right now, I can't figure out how the sorting works. I am using Sort by "_Score" descending without any additional rule.

I have tried using "None" and "User defined" on the product catalog module but it does not seem to change anything.

I have also tried "Use group sorting".

I am running out of ideas.

I am using DW 9.8.5. I am not sure if it has any relevance.

Thank you,
Adrian

 


Replies

 
Nicolai Pedersen
Reply

Hi Adrian

Score is Lucene scoring - which is impossible to understand exactly how works. When you only have one parameter, groupid, you probably get the same lucene score for all documents, and then the order will be something 'random' - maybe document order in Lucene - lucene handles all that.

When using "Use group sorting" the index will try to sort products by its groupid looking at some dw built in fields in the index - but since your products are in subgroups and their sorting value comes from the subgroups, it will not have affect on parent group searches with no products in them.

If you use group sorting, each product in each subgroup has a sort value - so if you have 3 subgroups, the first product in all groups will have the same sort value - 1.

So to do what you want, you need to create a combined sorting field you can use for this scenario - a combination of subgroup sorting value and product sorting value and put it in a new field.

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Thank you. Sounds like a good plan.

In the meantime I have added 2 sorting criteria. First by ParentGroupId and then by score.

Of course, this is working now becuase I have defined the GroupIds consistently and will probably break (or not sorting properly) once the groups will be defined randomly.

I will try to add this combined field as it seems to be more reliable on the loing run.

Thank you,
Adrian

 

You must be logged in to post in the forum