Developer forum

Forum » Development » Sorting of variants in new index

Sorting of variants in new index

Anders Ebdrup
Reply

Hi Dynamicweb,

 

We are missing the possibility to sort variants in the new index after the sort order, so "Small" can be displayed before "Medium" and so on.

 

Best regards, Anders


Replies

 
Nicolai Høeg Pedersen
Reply

Any ideas to what data to add to the product index?

Given that I have products in colors, sizes, styles. Would I add a ColorSort, SizeSort, StyleSort that has the value of the option sort?

 
Anders Ebdrup
Reply

Hi Nicolai,

 

Actually, for now, I am just missing a template tag when looping my facet options, which tells me the right order of the variants from the custom sorting in the administration.

 

Best regards, Anders

 
Nicolai Høeg Pedersen
Reply

Hmm, let me see what we can do. It is not that simple since that facets are coming from the index and does not have a link directly to the database. And we do not want to introduce a performance hit on this part. Let me get back to you.

 
Anders Ebdrup
Reply

I think only the VariantOptionId is stored in the index - the name is already fetched from the api when looping the variant option for the facets

 

This is from GetProductsFromIndex:

                                    Dim vo = VariantOption.GetVariantOption(facetOption.Value.ToString())
                                    If vo IsNot Nothing Then
                                        facetOption.Label = vo.Name
                                    End If

 

I think the main problem would be the abstraction as a sortorder does not make sense for some of the other facets.

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Anders

You are quite right. Added the sort order to the facet options (FacetOptions loop) - for variants and custom fields. TFS#19091 due with the next 8.7.0.* release.

BR Nicolai

Votes for this answer: 1

 

You must be logged in to post in the forum