Developer forum

Forum » Ecommerce - Standard features » url - linking to variant

url - linking to variant

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

I am working on a product variant selector, where i need to get the main/primary image for the selected variant. I presume the best way is to load the variant on a page Asyncronous, and fetching the image from here? But what is the URL structure for a certain variant of a product?

Is there a better way to fetch main images for a specific variant?

 

/Hans


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Hans

Url for the variant: Default.aspx?ID=123&GroupID=GROUP1&ProductID=Prod1&VariantID=VO1.VO2

If you are using the product catalog for viewmodels, you have a property VariantInfo of type VariantInfoViewModel on the ProductViewmodel. On the VariantInfoViewModel (which is a tree of your variant structure, i.e. black->Small) has an Image property which will give you the primary variant image. 

Votes for this answer: 1
 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Perfect, thank you 👍

 

/Hans

 

You must be logged in to post in the forum