Question

How can I show invoice id in \app\code\local\Mage\Sales\Model\Order\Pdf\Abstract.php

I don't need to show getRealOrderId() into pdf invoice, but I need invoice id.

How can I do that?

Was it helpful?

Solution

First be sure, that your order is loaded ... take a look at:

protected function insertOrder(&$page, $obj, $putOrderId = true)
{
    if ($obj instanceof Mage_Sales_Model_Order) {
        $shipment = null;
        $order = $obj;
    } elseif ($obj instanceof Mage_Sales_Model_Order_Shipment) {
        $shipment = $obj;
        $order = $shipment->getOrder();
    }
    .....
}

So later you can use this snippet:

$invoiceIncrementId = '';
if ($order->hasInvoices()) {
    // "$_eachInvoice" is each of the Invoice object of the order "$order"
    foreach ($order->getInvoiceCollection() as $_eachInvoice) {
        $invoiceIncrementId = $_eachInvoice->getIncrementId();
    }
}

I referred, that forum reply: http://www.magentocommerce.com/boards/viewthread/198222/#t393368

Good luck.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top