Tuesday, August 9, 2011

Get ordered items and their details from ordered id in magento

$itemcount = 0;
$order = Mage::getModel('sales/order')->load($order_id);
$items = $order->getAllItems();
$itemcount=count($items);
$name=array();
$unitPrice=array();
$sku=array();
$ids=array();
$qty=array();
if($itemcount > 0){
	foreach ($items as $itemId => $item)
	{
	    $name[] = $item->getName();
	    $unitPrice[]=$item->getPrice();
	    $sku[]=$item->getSku();
	    $ids[]=$item->getProductId();
	    $qty[]=$item->getQtyToInvoice();
	}
}

1 comment: