Developer forum

Forum » Ecommerce - Standard features » sort (current group)

sort (current group)

Thomas Jensen
Reply

Hi

Is there a way to sort product by the sort filed in current group

if using "sort (primary group)" and a product has a primary group set to a difrent group than current, then the value from that primary sort impacts the current

having no sorting seams to take the products in the order as they way added

 

I want to sort in the order of the values from this SQL
SELECT GROUPPRODUCTRELATIONSORTING FROM EcomGroupProductRelation WHERE GROUPPRODUCTRELATIONGROUPID = [current groupID]

How can i set this up i Repositories, or in razor,
or is this a new feature that is needed, to use it in Product catalog app

 

Regards, Thomas


Replies

 
Nicolai Pedersen
Reply

Hi Thomas

You cannot, and we cannot make it using Lucene and many-to-many relations between products and groups - technically impossible or will perform bad.You have to use the database driven model if this is important for you. You can then load facets using a async call.

Since all products will have multiple sort order depending on the group context, we have to retrieve all productids from the index when you search (that could potentially millions), sort them based on your context(s), and then query the N products from the database that needs to be shown on this page. What we do now is that we do the search and sorting in Lucene.

In implementations where the index is used for searching, facetting etc. it will also hardly make any sense to do this. Then you have to go back to an old fashioned implementation with a group navigation page and a search result page - but that does not sound very 'modern'.

Why is this important - can you describe the use/business case - maybe there is another implementation option?

BR Nicolai

 
Thomas Jensen
Reply

Hi Nicolai

We have at the moment 2 customer (jagtjakt.dw9.dynamicweb-cms.com, scanbur.dw9.dynamicweb-cms.com)
that wants the sorting in the frontend to be the same as it is in backend, in the "sort products" list (or the list whitout any collumn sorted)

so we just want to do the same sort as it is in backend,
where we have control of the product sort

In frontend I do not search subgroups, all products (or the products that is wanted in a group) have been added to set group

I do see the complexity of it from a index view,
but in the DB i have the sort list, but it reference the group (groupID) and not the product
 

Regards, Thomas

 
Nicolai Pedersen
Reply

ok, they want it - but why? Why is the sortorder important? What products bubble on top - those that sell most, or the newest? It might be something that can be automated...

 
Rune Skovbo
Reply

Hej Nicolai,

Vi har ogse en kunde som har behov for dette.

Hvorfor? De sælger højt specialiseret udstyr som skal vises i en rækkefølge som de definerer, afhængigt af hvilken gruppe et produkt vises i. Her kan vi ikke bruge automation.

Nu skal jeg ikke kloge mig for meget på teknikken bag - så hermed bare en tanke: Når man nu kan sortere produkterne i DW i en given gruppe. Så må denne kombination af gruppe og prioritering da kunne hentes med i indexet, så DW kan bruge den?

Anyways - det er i hvert fald noget vi har behov for - især i forbindelse med flere af vores B2B shops.

Regards, Rune

 
Nicolai Pedersen
Reply

Hi Rune

I have no solution to it. If you are on Lucene, the product can have only one sort value since there are no relations to groups. So using the "sort (primary group)" field is the only option.

If you can explain a way to implement it, I'll be happy to give it a go... (The only option I can think of, is to create a sort field on the index for each product group in the solution. So if you have 100 groups, you would have 100 fields like 'Group101Sort' etc.)

But you can just use database driven product lists, it will work fine...

BR Nicolai

 
Rune Skovbo
Reply

Hi again,

FYI (and for anyone else ending up on this thread) - we ended up handling it on the product list template, where we just look at the eComGroupProductRelation field in the database, match it with the current group and sort the products accordingly.

Regards,
Rune

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Rune,

 

I am glad that works our for you, but I am assuming that only works when you don't have any type of paging and you're seeing products from a single group at a time. 

 

Best Regards,

Nuno Aguiar

 
Rune Skovbo
Reply

Hi Nuno, 

Agreed - pagination and/or multiple groups shown at the same time would ruin it.

Multiple groups wouldn't work for the database model either though, I guess? But yes, the ability to use pagination is lost. I do see this as being a "fix" though, for clients expecting to be able to sort products differently depending on the group. 

Regards,
Rune

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Rune,

 

Yeah, that sounds right. I'd just be careful about this, because as you figured out it's not scalable.

 

Nuno Aguiar

 

You must be logged in to post in the forum