1

Suppose I have a bundle product added into the cart. Now when I try to get all cart items that time I need to find particular bundle child is added with x bundle product.

Is it possible to find ?

1 Answer 1

1

You can try below code rendering bundle product items from quote.

$cart = Mage::getModel('checkout/cart')->getQuote();
foreach ($cart->getAllItems() as $_item) :
    $_product = Mage::getModel('catalog/product')->load($_item->getProduct()->getId());
    if($_product->getTypeId()==='bundle') :
        $options = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());
        ?>
        <dl class="item-options">
            <?php foreach ($options['bundle_options'] as $option):?>
                <dt><?php echo $option['label'] ?></dt>
                <?php foreach ($option['value'] as $sub) :?>
                    <dd><?php echo $sub['qty'] . " x " . $sub['title'] . " " . Mage::helper('core')->currency($sub['price'])  ?></dd>
            <?php endforeach;
            endforeach;
            ?>
        </dl>
    <?php endif;

endforeach;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.