Developer forum

Forum » Templates » Cartcmd=Addmulti javacript function only adds variants for the first product

Cartcmd=Addmulti javacript function only adds variants for the first product

Martin Gammelholm
Martin Gammelholm
Reply

DW 9.8.11

I'm implementing an addmulti javascript function which is working fine, except it only adds variants to the first product added every time to the cart. I'm using this example from Jeppe:
https://doc.dynamicweb.com/forum/development/development/adding-multiple-products-in-the-cart

See this screencast:
https://mg-co3.tinytake.com/msc/NjUwNzk3MF8xODk4MTAzNg

When I add to cart the first time, the "main" product is added with variants. Then I move the "main" product after the "optional products", and now when I add to cart the optional product is added with variants, but not the "main" product.

The products you see in the dropdown is just related products, but this shouldn't matter, as I seem to have the correct data in the parameters.

BR
Martin


Replies

 
Nicolai Pedersen
Reply

Hi Martin

I was looking in the old code - can you try a workaround - instead of using "addmulti" as cart command, try using "setmulti" - the rest of the request is the same.

BR Nicolai

 
Martin Gammelholm
Martin Gammelholm
Reply

Hi Nicolai,

Thanks for you reply! Unfortunately it's the same result with SetMulti, only the first product is getting variants added.
I guess doing a normal form submit would give the same outcome, as it is the same post.

Any other suggestions or is this a bug in 9.8? 

BR
Martin

 
Nicolai Pedersen
Reply

I think I will have to see it. Can we get a link to the page with the problem

And of course you could try this on a 9.12 or 9.10...

 
Martin Gammelholm
Martin Gammelholm
Reply

Hi Nicolai,

We've pushed the latest changes to staging here:
https://mobler.1stweb-staging.net/produkt/zensizone-elevation-180x210-inkl-topmadras-1

If you select "Gavl" and "Ben" and then click the add to cart button, you can see the post in the console.

 

BR
Martin

 
Martin Gammelholm
Martin Gammelholm
Reply

Nicolai

You can see the problem on this url now: https://mobler.1stweb-staging.net/produkt/zensizone-elevation-180x210-inkl-topmadras-1?optional=true

 
Martin Gammelholm
Martin Gammelholm
Reply

Nicolai any status on this one? :)

BR
Martin

 

You must be logged in to post in the forum