0
votes

I am trying to create individual "Add to Cart" buttons for each product in the Grouped Products table in a magento store but am unsure of how to do this.

At the moment the table that is shown for a grouped product on a product page has a column for the product name, the products price and a quantity box for users to enter their requirement before clicking an " add to cart" button below the table.

I would like the quantity column to be an individual "add to cart" button for each of the grouped products that adds 1 of that option into the cart.

I have ftp access etc and the magento store version is community 1.7.0.2

2

2 Answers

0
votes

You can achieve this modifying your product template. It is possible to add products to the cart via query string. Have a look at the controller Mage_Checkout_CartController.

Add following code to the lines in your groupedproduct columns:

<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="addtocart" onclick="setLocation('<?php echo Mage::getUrl('checkout/cart/add', array('product'=>$_item->getId(),'qty'=>1)) ?>')"/>
0
votes

This worked for me: https://magento.stackexchange.com/questions/11237/add-to-cart-button-next-to-each-grouped-item

I changed value from

value="<?php echo $_item->getQty()*1 ?>"

to

value="1"