Magento 1.8 – How to Get Cart Item by Using Cart Item ID

cartmagento-1.8

I am updating multiple cart items at a glance. And i have updated cart item id's with me. Now i want to get CART item data by its id.

Can you plese help me on this.

Best Answer

This should be done with the Mage_Sales_Model_Quote_Item class. If you're updating several items it might be better to use it's collection tho.

$the_item_ids = array(2,5,6,8);

$collection = Mage::getModel('sales/quote_item')->getCollection()
   ->addFieldToFilter('item_id', array('in' => $the_item_ids));

foreach($collection as $item)
{
  var_dump($item->getData());
}