Magento Get All Visible Items From Order


Magento Get All Visible Items From Order : You can get the all visible items from the order simply using $order->getAllVisibleItems() which will give you all visible items of order. Here in this example we are going to explain how to get visible items of order on magento with different example.


Magento Get All Visible Items From Order

First load order by order id or increment id and then get all visible items as below –

Magento Get All Visible Items From Order:

// Load by order id
$order=Mage::getModel('sales/order')->load($orderId);
//Or load by Increment Id
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
$orderItems = $order->getAllVisibleItems();
foreach ($orderItems as $item) {
    $productId = $item->getProductId();
    $product = Mage::getModel('catalog/product')->load($productId);
	$name = $product->getName();
	$sku = $product->getSku();
}

The above example will give you all visible items of order.


User Ans/Comments

📖 Read More


Advertisements