Jump to content

with Zencart, how can I add multiple items in one form... one click


mac007

Recommended Posts

Hi, all:

 

I need to have a form, where people can select different quantities of different products, and then submit all at once to cart.

 

I was reading that one can use the "multiple_products_cart_quantity" form structure, so I set this code up, that has 2 product id's, but it's not working right, only added the last item. What am I doing wrong?? appreciate the help!

 

Thanks!

 


<form name="multiple_products_cart_quantity" action='http://www.mysite.com/shopping-carts/zen-cart/index.php?main_page=product_info&action=add_product' method='post' enctype='multipart/form-data'>

<input type="text" name="cart_quantity" value="1" maxlength="6" size="4" /><br /><br /><input type="hidden" name="products_id" value="1" />
<input type="text" name="cart_quantity" value="1" maxlength="6" size="4" /><br /><br /><input type="hidden" name="products_id" value="2" />
<input type="image" src="includes/templates/template_default/buttons/english/button_in_cart.gif" alt="Add to Cart" title=" Add to Cart " />
</form> 

Not sure how that is suppose to work (IE what the script expects) but you are naming the input boxes exactly the same, this is problematic as you have noticed. It simply sends you the last item.

 

Look in the documentation and see what the page is expecting, either an array which would be setup like this:

 

<input type="text" name="cart_quantity[1]" value="1" maxlength="6" size="4" /><br /><br /><input type="hidden" name="products_id[]" value="1" />
<input type="text" name="cart_quantity[2]" value="1" maxlength="6" size="4" /><br /><br /><input type="hidden" name="products_id[]" value="2" />

 

But really I am not sure, I would look at the FAQ or documentation for the multiple product insert and see what you need to do, as it all depends on how the zend cart handles it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.