I have looked whole of the google and could not find a working solution for my requirement. Please help.
I am trying to get total quantity of all the ordered items in success.html. I am able to get order id and subtotal and want total qty of all the items ordered.
I can do this in cart page but not on success page.
Try below code,
<?php
$order=Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());//increment_id,like 100000004
$ordered_items = $order->getAllItems();
foreach($ordered_items as $item){
echo $item->getSku();
echo "<br />";
echo $item->getQtyOrdered();
echo "<br />";
//ordered qty of item
echo $item->getName();
echo "<br />";
// etc.
}
?>
To get total qty of an order,use below code.
$order->getData('total_qty_ordered');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With