Developer forum

Forum » Development » Add multiple related products to cart

Add multiple related products to cart


Reply
Hi there.

Let's say i've got this product in eCom called MainProduct.

MainProduct got 4 related products on the same page with a textinput for how many of each related products they want.

So it's like this:

{QuantityInput} Main Product
-----
{QuantityInput} Related1
{QuantityInput} Related2
{QuantityInput} Related3
{QuantityInput} Related4
-----
[Add to cart]

And then it adds all the products to the list. But how? This doesn't work - when i add a product it doesn't add anything:



Replies

 
Nicolai Høeg Pedersen
Reply
You can do like this:

http://engage.dynamicweb.dk/Adding-multiple-products-to-the-shopping-cart-195.aspx
 
Reply
Yes, i know - and i think that's what i've done :-)

Notice; this is when i'm already on a product - not on ProductList.
 
Nicolai Høeg Pedersen
Reply
Makes no difference if you are on a product or a product list.

Its possible - your template just have to be ok... Check the form tags are closed correctly and not too many - and make sure you submit the form and does not have a add to cart link as in the default template.
 
Reply
Hi again NP, and thanks for the quick answer.

Can't you see the code i've posted in this thread? It's almost a copy of the script you reffered to.

Can you see anything wrong with the HTML in #0 ?
 
Nicolai Høeg Pedersen
Reply
Reading the documentation and comparing to your code...

- method on the form is wrong (should be post, not get).
- the first quantity field have a wrong name.
- you are missing the hidden fields on the main product
- Your values are 0 - remember to set them to 1 before submitting

Make sure you post the same from a product as you do from the product list - compare your posts.
 
Reply
Ahh, 

Alright - the method="post" did it. :-)¨

Thanks.

 

You must be logged in to post in the forum