I have bundle products with 3 checkboxes checked as default. I want to add a bundle product from the page category list (list.phtml
) without having to specify the o
Joras' solution works, but it can create multiple items in the quote, each containing the same bundle (with identical selections). The reason is that when comparing a a newly added bundle with the quote items, Magento (tested on 1.9.2.2) creates a bundel_identity string composed out of
[product_id]_[option_id_1]_[option_qty_]_[option_id_2]_[option_qty_2]...
The this string depends on the order of the parameters submitted. To follow the order specified in the product settings use :
$typeInstance = $product->getTypeInstance(true)
->setStoreFilter($product->getStoreId(), $product);
$optionCollection = $typeInstance->getOptionsCollection($product);
foreach ($optionCollection as $option) {
// build your query string here....
}
Also it is quite a hacky¡ to do that inside the template. Better option imo
override Mage_Catalog_Block_Product_List::getAddToCartUrl($product, $additional = array())