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
I had to do similar thing in Magento 1.7 website. I was able to add bundled product to cart from products lists without redirecting to product page.
/app/design/frontend/your_package/your_theme/template/catalog/product/list.phtml
Replace occurences of
with
helper('checkout/cart')->getAddUrl($_product);
if ($_product->getTypeId() == 'bundle'):
$bundleOptions = '?';
$selectionCollection = $_product->getTypeInstance(true)->getSelectionsCollection($_product->getTypeInstance(true)->getOptionsIds($_product), $_product);
foreach($selectionCollection as $option):
$bundleOptions .= '&bundle_option[' . $option->option_id . ']=' . $option->selection_id;
$bundleOptions .= '&bundle_option_qty[' . $option->option_id . ']=1';
endforeach;
$productAddUrl .= $bundleOptions;
endif;
?>