Magento get items in order
Here, I can show you how you can get information about all items in your magento shopping cart based on order id. How to get product details from order id or sometimes need to get product it, product sku, product name , category id, category name. So its easy to get product from order item based on order number. [php] <?php require 'app/Mage.php'; Mage::app(); $orderNumber = 100004544; $order = Mage::getModel('sales/order')->loadByIncrementId($orderNumber); // get order total value $orderValue = number_format ($order->getGrandTotal(), 2, '.' , $thousands_sep = ''); // get order item collection $orderItems = $order->getItemsCollection(); foreach ($orderItems as $item){ $product_id = $item->product_id; $product_sku = $item->sku; $product_name = $item->getName(); $_product = Mage::getModel('catalog/product')->load($product_id); $cats = $_product->getCategoryIds(); $category_id = $cats[0]; // just grab the first id $category = Mage::getModel('catalog/category')->load($category_id); $category_name = $category->getName(); echo "orderNumber=".$orderNumber."<br/>"; echo…