Add bundle product to cart without having to specify the options

后端 未结 4 1133
-上瘾入骨i
-上瘾入骨i 2021-02-03 13:30

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

4条回答
  •  时光取名叫无心
    2021-02-03 14:25

    Ok, I finally got it working the way i think it should.

    Wgenie put me in the right direction.

    I use this code instead of Wgenie's and it not only adds the item to the cart but controls the stock of the bundle options and shows Not available if one option is out of stock:

    getTypeId() == 'bundle') : ?>
    
    getTypeInstance(true)->getSelectionsCollection( $_item->getTypeInstance(true)->getOptionsIds($_item), $_item ); ?> load($option->product_id); $stocklevel = (int)Mage::getModel('cataloginventory/stock_item') ->loadByProduct($opt_product)->getQty(); if($stocklevel<=0) $saleable = false; ?>

    __('Out of stock') ?>

提交回复
热议问题