Prevent accelerator variant grouping when grouping field is empty

We would like to group variants, e.g. on the category pages, according to a product grouping field. But we only want this grouping to occur if the grouping field has a value, i.e. keep variants without a value as separate boxes on the category page.

The reason is that some products in the field template should be grouped, but others should be ungrouped. And the only way to currently achieve this is to “invent” separate values for the grouping field for all non-grouped variants, which we don’t want.

Is there an out-of-the-box accelerator way to accomplish this? If not, where in the accelerator should we look?

Litium version: 7.6.2

Are you using Lucene or Elastic?

For Elastic, you could update CreateModelsPerChannel to introduce your logic and only group the variants with values and then index the variant without values as separate documents.

Thank you.

We are using Lucene in development currently, but Elastic in production.

For Lucene it looks slightly more complicated, but it looks like I should update VariantIndexDocumentMerger.Merge to do the same thing as for Elastic?

Yes, for Lucene you need to update VariantIndexDocumentMerger instead.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.