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 ?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityYou 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;