Developer forum

Currently discussing: Plans to implement a Consent module for GDPR compliance.

Join the discussion!

Forum » Rapido and Wrap » Open product by color variant

Open product by color variant

Søren Bremholm Jakobsen
Reply

Hi,

working on a rapido solution where the customer wants to open a product from the productlist (ProductsRender Template) by clicking on a color variant image (not a size) and then get directed to the product page with the color (not size) selected. It looks like DW needs both info regarding color and size variant. We need a Url like ex. this "en/products/men/svartisen/mustard" (where mustard is the color variant) but it looks like DW only accepts an url with a size  to open the product page with a color variant selected (en/products/men/svartisen/mustard/black-42). Any suggestions?

Replies

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

Hi Søren

The validation of the VariantID parameter comes from settings, Web & Http, Customized URLs, and disables "Use strict URL recognition". Maybe you can just disable that. That will prevent you from getting a 404. That might be enough.

As an alternative: Dynamicweb cannot understand partial variantids right now. But you can make your own rendering logic relatively simple. So when someone clicks the color image, simply use a variable you invent your self, i.e. "&PrimaryVariantID=VO1" - Dynamicweb will ignore that, and you can react on it in the product detail template and render the right image.

It will not solve the url issue though...

BR Nicolai

Votes for this answer: 1
 
Søren Bremholm Jakobsen
Reply

Thanks. Made the alternative solution

 
Søren Bremholm Jakobsen
Reply

Hi Nicolai,

I managed to open the prduct page with the pictures selected based on the users selection on the productlist page.

No I'm trying to set the selected variant color image active based on the users selection on the productlist page. Have tried to modify the product feed template to set the selected property in the variant option loop:

string variantparameter = HttpContext.Current.Request.QueryString["primaryvariantId"];

if (!string.IsNullOrEmpty(variantparameter))

{

if (variantparameter == variantoption.GetString("Ecom:VariantOption.ID"))

{

variantOptionObject.selected = "checked";

hasSelection = true;

}

}

 

You must be logged in to post in the forum