Developer forum

Forum » Templates » variantid
Dennis Thrane
Reply
I'm having problems with variantid. DW changes the code on the "add to basket" button when it renders the page.
It worked when I tested with variants manually created in DW. But after we did a integration to a ERP system, it removes some code when it renders.

The button code looks like this in my template.
<a href="Default.aspx?ID=<!--@Ecom:Product:Page.ID-->&ProductID=<!--@Ecom:Product.ID-->&variantid=<!--@Ecom:Product.DefaultVariantComboID-->&quantity=1&cartcmd=add"><img src="/Files/System/add_to_basket_button.gif" width="121" height="72" border="0" alt="Tilføj til kurv"></a>


The following code is removed by DW.
&variantid=<!--@Ecom:Product.DefaultVariantComboID-->

Replies

 
Nicolai Høeg Pedersen
Reply
Hm - we need a link to checkout what that is... It is probably the URL rewriting that replaces the parameter and value with a name in the URL.
 
Dennis Thrane
Reply

http://billingsko.net.dynamicweb.dk/Dame/Sko-test/Sko/-Billi-Bi-kilehæl-sort.aspx

Here is a link.

In another template I have to force the value on with a JavaScript to make it work.
 
Nicolai Høeg Pedersen
Reply
&variantid=<!--@Ecom:Product.DefaultVariantComboID--> is replaced by /36.aspx which is the name of the variant with that ID. This is by design, and your add to cart also adds the product in size 36 to the cart as it is supposed to do.

I can see you have made a variant selector on the size. So you need to build the add to cart link dynamically or you need to post a form to add the product to cart instead of using a link.

You would do something like this:
<form name="<!--@Ecom:Product.ID-->" id="PRODFORM_<!--@Ecom:Product.ID-->" method="get">
<!--@Ecom:Product.Form.Clean-->
...more form...
</form>

 

You must be logged in to post in the forum