Try our conversational search powered by Generative AI!

Product Variants

Vote:
 

Hi All

I am new to episerver commerce and getting to grips with it. I can't seem to find the code to show product variants on a product page. I have two requirements.

1) To show the size and colour option for a product on the details page. I need a bit of information on setting up the product in the catalog manager - unless it is just creating a product and a vairant and adding the variant to the product.

2) Second I need to show the colour options on the product list page.

Kind Regards

Sandeep

#51651
Jun 19, 2011 20:18
Vote:
 

1)  in administration in commerce manager create a metaclass for the variation with metafields Size and Colour. in catalog in commerce manager create  new entries of type variation/sku that uses that metaclass. in catalog in commerce manager create a new entry of type product and add variations/skus below the tab variations/skus.

2) In the display template access the variations/skus by accessing the Entry.Entries property. To access the values of the metafields of the variation use Entry.Entries.Entry[x].ItemAttributes.Attribute.FirstOrDefault(attr => attr.Name == "Size").Value[0] and Entry.Entries.Entry[x].ItemAttributes.Attribute.FirstOrDefault(attr => attr.Name == "Colour").Value[0]. Distinctly get the values and present it in the in the display template. When the user har selected a size and colour use these values to do a reverse lookup of which variation/sku thats matches these item attributes.

Hope this helps.

#51665
Edited, Jun 20, 2011 11:54
Vote:
 

Hi Marucs

Thank you very much for your response. This is exactly what I was looking for.

Kind Regards

Sandeep

#51676
Jun 20, 2011 17:35
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.