Developer forum

Forum » Development » Problem with variant facets in New Index

Problem with variant facets in New Index

Anders Ebdrup
Reply

Hi Dynamicweb,

 

We are facing a rather big issue with the variant facets, which are not summarized correctly as it does not take into account whether the variants are on stock or even if the variant is active.

This issue is seen when dealing with extended variants. Say I have a color; blue, but for my shirt this color is not on stock/active, but is still shown in the facet filter and the main product is shown after filtering.

How can I solve that?

 

Best regards, Anders


Replies

 
Nicolai Høeg Pedersen
Reply
Hi Anders

If your list shows the variants, you add the active and stock levels to the search on your index, see dump.
 
If your list shows only main products, it is the main products stock that counts, and all the variants that it comes in.

To work around it if using method 2 above, there are 2 options. 1st option is to generate a 2nd search that searches variant documents (and not main documents) and use that for loading variant option facets/counts for the variant facets (i.e. color and sizes) - and take stock into consideration. When setting this up, parameter names should match in the 2 searches.
 
2nd option is to change the indexer to only include variant options on the main product for variants that are in stock. This requires a change to the indexer.
 
Both versions requires that the index is rebuild every time the stock changes. Using option 1 the variant document needs an update, using option 2, the main product document requires an update.

BR Nicolai
 
Capture.PNG
 
Anders Ebdrup
Reply

Hi Nicolai,

Thank for your answer. And then you suggest to load the facet with ajax??

 
Nicolai Høeg Pedersen
Reply

Hi Ander

Yes, that would be my best bet.

Nicolai

 
Adrian Ursu
Reply

Hi Guys,

Have you managed to find an easy solution to this problem?

I believe that this platform should offer this functionality out of the box and not depend on a customization done by each developer.

Should I put this into a Feature Request in order to make it to a release? 

Thanks,

Adrian

 

You must be logged in to post in the forum