Magento get all invoices and shipments of an order

· kalpesh

Getting all the invoices of an order:

$order = Mage::getModel(‘sales/order’)->load($orderID);  
if ($order->hasInvoices()) {  
 $invIncrementIDs = array();  
 foreach ($order->getInvoiceCollection() as $inv) {  
 $invIncrementIDs[] = $inv->getIncrementId();  
 //other invoice details…  
 } Mage::log($invIncrementIDs);  
}

Getting all the shipments of an order:

$order = Mage::getModel(‘sales/order’)->load($orderID);  
foreach($order->getShipmentsCollection() as $shipment)  
{  
 Mage::log($shipment->getData()); //get each shipment data here…  
}

#invoice #magento #order #shipment