Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Bulk Product Add to Cart
 
corradomatt
Sr. Member
 
Total Posts:  161
Joined:  2008-09-01
San Diego, CA
 

So I am still trying to figure out a way to allow customers to add products to their shopping cart in bulk. What I need is a way to add a table to a cms page that allows our customers to add multiple product sizes and colors to their cart with 1 button click...the table would look something like the attachment.

Here is the code I have so far, but it obviously does not add a product value to the input name. I’m not sure how easy this will be or if it is even possible. I’m not a trained programmer and I’m just learning. I can’t figure out where to go from here.

<form action="/store/index.php/checkout/cart/add" method="post">
<
label for="qty">Quantity</label>
<
input name="qty" type="text" class="input-text qty" id="qty" maxlength="12" value=""/>
<
button class="form-button" onclick="productAddToCartForm.submit()"><span>Add to Cart</span></button>

<
script type="text/javascript">
    var 
productAddToCartForm = new VarienForm('product_addtocart_form');
    
productAddToCartForm.submit = function() {
        
if(this.validator.validate()) {
            this
.form.submit();
        
}
    }
.bind(productAddToCartForm);
</script>

Is there any way to add a product identifier to the above code?

Image Attachments
product-cms-page.gif
 
Magento Community Magento Community
Magento Community
Magento Community
 
corradomatt
Sr. Member
 
Total Posts:  161
Joined:  2008-09-01
San Diego, CA
 

Ok, so I’m experimenting with some different ideas......

I cleaned up the form action and tried changing the input name of the quantity input box to “product[100]” hoping that would add product id 100 to the cart.....no luck. Here is the code I was playing around with.......


<form action="checkout/cart/add" method="post">
<label for="qty">Quantity</label>
<input name="product[100]" type="text" class="input-text qty” id="qty" maxlength="12" value="1"/>
<button class="form-button" onclick="productAddToCartForm.submit()"><span>Add to Cart</span></button>

<script type="text/javascript\">
var productAddToCartForm = new VarienForm(’product_addtocart_form’);
productAddToCartForm.submit = function() {
if(this.validator.validate()) {
this.form.submit();
}
}.bind(productAddToCartForm);
</script>
/code]

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top