سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top