Magento 1.9 Orders – How to Get Invoice ID or Details from Order

invoicemagento-1.9orders

how to get invoice deatils or id by order object ?

$orderObject = Mage::getModel('sales/order')->load($orderId);

Any Method to get invoice_id from above order object ?

Best Answer

Your code only provides the one invoice which has been created first for this order. But an order may have multiple invoices as Magento is capable of creating multiple partial invoices, then you will have multiple invoice details.

The following code loads all associated invoices:

 $orderObject = Mage::getModel('sales/order')->load($orderId);

 $invoiceCollection = $orderObject->getInvoiceCollection();
 foreach($invoiceCollection as $invoice):
    //var_dump($invoice);
    $invoiceId =  $invoice->getId();
    $invoiceIncrementId =  $invoice->getIncrementId();
 endforeach;