PHP Magento Tips

How to get all the Product Options in the Cart Page in Magento ?

Rate this posting:
{[['']]}

On the Magento cart page you will find the following foreach loop:
<?php foreach($this->getItems() as $_item):

Now if you want to add some additional stuff or want to do some customization on that cart page, then you definitely need all that product options which you added in your cart.

Today i will show you how to get all that custom option on Cart page, so you can easily do your work.

you can make array of $_item with below code and will get all custom options of added product in cart..
$arr = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());

You can simply debug above code with:
<?php foreach($this->getItems() as $_item):
 $arr = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());
   
 echo "<pre>";
 print_r($arr);
 echo "</pre>";
?>
<?php echo $this->getItemHtml($_item) ?>
<?php endforeach ?>


Tag : Magento
0 Comments On "How to get all the Product Options in the Cart Page in Magento ?"

Back To Top