tags:

views:

32

answers:

1

I have this code, which would add one bundle product with the ID of 171 to the cart, given the option of a product with the color(23) Magenta(63). Is there any way to set a quantity to the option, like say we want to set the quantity to 2 of those items with that color?

Thanks for the help.

$params = array(
        'product' => 171,
        'bundle_option' => array(
            23 => array(
                0 => 63
            ),
        ),
        'qty' => 1,
    );

    $cart = Mage::getSingleton('checkout/cart');
    $product = Mage::getModel('catalog/product');
    $product->load(171);

    $cart->addProduct($product, $params);
    $cart->save();
A: 

Have you tried intercepting the request to addtocart and seeing what a normal post array for that bundle would look like? That should give you the structure that you need.

Joseph Mastey