开发者

How do I set the quantity of the option in my bundle product?

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(开发者_如何学C
        '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();


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜