cancel
Showing results for 
Search instead for 
Did you mean: 

bundled product description in shopping cart

bundled product description in shopping cart

I have bundle products with option and some simple products inside.

example:

BUNDLE
option1
-simple1
-simple2
option2
-simple3
-simple4

you choose option1/simple1 and option2/simple4 and click "add to cart".

Now, I would like to show in cart "short_description" of simple1 and simple4 ...

I found this code

<?php 
 $product = Mage::getModel('catalog/product')->load($_item->getProduct()->getId()); 
  if($_product->getTypeId()==='bundle') :
    $selections = $product->getTypeInstance(true)
->getSelectionsCollection($product->getTypeInstance(true)
->getOptionsIds($product), $product);
foreach($selections as $selection){ ?>
<p><?php echo $selection->getShortDescription(); ?></p>
<?php }
 endif; ?>

But this code gives me the description of all the simple products content in the bundle.

How can I show ONLY the products in the cart?!?!?

thank you

2 REPLIES

Re: bundled product description in shopping cart

You should list cart items, with 

$quote = Mage::getModel('checkout/session')->getQuote();

foreach($quote->getAllItems() as $item) {
 ...
}

Then, you can see if an item is a bundle or not with $item->getProductType() and the relationship with $item->getParentItemId() ...

Then, to grab the short description of a cart product : $item->getProduct()->getShortDescription() should do the trick.

 

 

 

Re: bundled product description in shopping cart

Hi thanks for your reply.


I'm working in this file

frontend/mytheme/default/template/checkout/cart/item/default.phtml


and if the item in cart is a simple product i get shortDescription with this code


<?php $custom = Mage::getModel('catalog/product')->load($_item->getProductId()); ?>
<p><?php  echo $custom->getShortDescription(); ?></p>

with this code i can show also shortdescription of the bundle but i need to show only the descriptions of selected otions of my bundle.

  ... your complete code look like this? i think not but I'm a "dummy" , sorry.


<?php
$quote = Mage::getModel('checkout/session')->getQuote();
foreach($quote->getAllItems() as $item) {
 $item->getProductType();
 $item->getParentItemId();
 echo $item->getProduct()->getShortDescription();
}
?>