Developer forum

Forum » Development » product variants

product variants


Reply

Hi! We have a customer that wants to have the product variants placed in a drop-down menu

I have managed to put all the variants in a drop-down-menu, but how do I pass the variant on to the cart? In the example templates the 'buy' links are renered inside the VariantCombinations-loop,

 

 

these tags dont seem to render outside this loop 

any Ideas/tips?

 

-jan


Replies

 
Reply

You just need to supply variant combination to the querystring, e.g. default.aspx?id=1&productid=PM19&cartcmd=add&variantid=VO1.VO10.

 

To get the value from the drop down, if it's not embedded in the form, use Javascript:

 

variantid = document.getElementById("DropDownID")[document.getElementById("DropDownID").selectedIndex].value;

 
Reply

Thanks!

 
Reply

No problem:)

 
Reply
I have done this little funktion:

function addToBasket()
{
 variantID = document.getElementById("selectColor")[document.getElementById("selectColor").selectedIndex].value;
 var url = "/default.aspx?id=<!--@Ecom:Product:Page.ID-->&productid=&variantid="+variantID+"&cartcmd=add";
 window.location.href = url;
}

I get stuck at the frontpage, but the variant is put into the basket. Is there any better way to do this?
 
Reply
What do you mean with "get stuck at the frontpage"?

You can link to any page you like, as long as the product ID, the variant ID and the cartcmd are in the query string.

Hope this helps,

Imar

 

You must be logged in to post in the forum