Developer forum

Forum » Ecommerce - Standard features » VariantGroup in ProductList

VariantGroup in ProductList

Harald Brouwers
Reply

Hello, I have a 'simple' question:

I have a Ecom shop with shoes, these shoes have two VariantGroups (Color, Size).

What I want to accomplish is to display all the available colors of a shoe model in the product list.

What I dit till now was loop through my Products -> VariantGroups -> VariantAvailableOptions. This gives me something like this:

Ecom:VariantOption.ID VO1
Ecom:VariantOption.Name Black
Ecom:VariantOption.Selected True

The problem is that some information (about images) is related to the 'master' product. The image name contains the Product.Number.

Can somebody tell me how  to display all the variants of a product in the productlist and be able to use data as the Product.Number from the main product?

P.S. I'm working in Razor.


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Harald

This is currently only possible using the new index. It has a field called "...FirstVariantOption" which is true or false depending on your dimensions. See dump 1.

You can use that in a search to filter out only first shoe of each color, and not the sizes. See dump 2.

BR Nicolai

Capture.PNG Capture1.PNG
 
Nuno Aguiar
Reply

Hi Nicolai,

 

This is very interesting. In which version did this came out? I don't see it in the release notes.

 

Best Regards,

Nuno Aguiar

 
Harald Brouwers
Reply

Hi Nicolai,

That is indeed a nice solution. For this project we already solved the problem by writing an Extender which gives back all te avialebal variant colors as individual products.

But I think using the index is nicer (and probably faster).

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

Hi Nuno

It is 19483 released with 8.7.1.

It was made in the very last seconds of the release, and after release notes were written - so we probably forgot to add them.

BR Nicolai

Votes for this answer: 1
 
Nicolai Høeg Pedersen
Reply

Hi Harald

I'm sure this method is much faster than an alterative where you look at the database. And you can combine it with facets and so on.

NP

 

You must be logged in to post in the forum