Developer forum

Forum » Ecommerce - Standard features » Variant visibility new index

Variant visibility new index

Peter Leleulya
Reply

I changed from classic to new index usage for a website.
Previously I had the eCom module set to "variant visibility: group by main product".

I noticed the product list view didnt handle the variants as before and discoverd those settings to be gone when selecting an index query in the eCom module.
What is the advised way to recreate the group-by-main-product functionality?


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Peter

On the query you defined in the management center, you can add a criteria: IsVariant = False and you now only have main products.

BR Nicolai

 
Keld Gøtterup
Reply

Hi Nicolai

But this will completely remove the variants from the index, and you cannot get results if you search for a specific variant so we still need another option for "group by main product" on the new index.

i have asked this question in this thread: http://developer.dynamicweb.com/forum.aspx?ThreadID=44205

 
Nicolai Høeg Pedersen
Reply

Hi Keld

It will not remove the variants from the index, but from the search result. And you can get a specific variant whereas the variant options are present on the main product as an array on the index document. So if you have a t-shirt, colors blue and red, you can find it searching "t-shirt blue" with the configuration i've mentioned.

You cannot however, search for a product number XYZ which is only present on the variant, where the main product has another product number.

We cannot make a "group by main product" option with the new index - it will not work since the number of records returned from the lucene would not match - that would make facets count wrong, paging act weird etc.

Each variant is a document in the index. We need to make sure that what we return from the index is 1-1 on records retrieved from the database. So if we need to filter out products, it has to be done in the search.

What could be done, was, instead of having one document for each master and variant, have one document in the index with the main product and their variants, holding all variant value as an array of values. I.e - ProductNumber as string[] containing an array of productnumbers.

 
Peter Leleulya
Reply

I just talked with Lars about the IsVariant option yesterday :)

We could make an index query for search including variants and another one for product list views excluding variants on the same index I suppose.
I think we'll manage.
Thanks for your reply.

 
Nuno Aguiar
Reply

Hi Peter,

 

Here's what you can do:

  • Create a Boolean (array if you want both variants and main products) parameter (ex: VariantsInResults) defaulting to False
  • Create an expression with isVariant to match that parameter

 

This will make sure you only list main products

 

Next step is to create a facet (or facet group)

  • Create a facet to manage VariantsInResults
  • You render that facet as a hidden field
  • Whenever you filter/search for results, you set it to True
  • In 8.8 and if you have a paragraph to manage search results, you re-set the default value for that parameter to true

 

Best Regards,

Nuno Aguiar

 
Adrian Ursu
Reply

Hi Guys,

I have another challenge that;s related to this one.

I have a client that has product with Variants and products without variants.

He wants to have in the same list Main products (if the products does not have variants) and Variants without main product is the product has variants.

How do I do that?

Thanks,
Adrian

 
Nicolai Høeg Pedersen
Reply

Hi Adrian

With the current information in the index, you can do it with an expression like this:

(isvariant = false and variantcombinations = null) or isvariant = true

Problem is the variantcombinations part - not sure if that is possible and how. Will check it out.

But a couple of new properties on the documents (HasVariants and IsMainProduct) could be helpfull.

BR Nicolai

 
Adrian Ursu
Reply

This means I have to play with the Products Loop and decide what to display?

 
Nicolai Høeg Pedersen
Reply

Bad idea, since it will break paging etc.

 
Adrian Ursu
Reply

Understood.

In this case how should I use the fields?

Remember, I have to list Products that does not have variants and variants in case the product has variants.

I dont't think this case is unusual for B2B scenarios where companies have both type of products. In our case this company is an Office Supply distributor.

Thanks a lot for the help.

Adrian

 
Adrian Ursu
Reply

Anyone?

 
Nicolai Høeg Pedersen
Reply

You cannot currently as far as I can see it.

 
Adrian Ursu
Reply

Thanks Nicolai.

I was afraid of this answer.

Any plan to fix that in the near future?

Thanks,
Adrian

 
Nicolai Høeg Pedersen
Reply

It is just one or 2 more properties on the lucene document - HasVariants and IsMaster.

What happens if you set the default variant on the main product?

 

You must be logged in to post in the forum