Magento:pdf中的发票ID

时间:2012-12-03 15:16:59

标签: magento invoice

如何在\ app \ code \ local \ Mage \ Sales \ Model \ Order \ Pdf \ Abstract.php

中显示发票ID

我无需在pdf发票中显示getRealOrderId(),但我需要发票ID。

我该怎么做?

1 个答案:

答案 0 :(得分:2)

首先请确保您的订单已加载...请查看:

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();
    }
    .....
}

所以稍后您可以使用此代码段:

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

我提到,该论坛回复:http://www.magentocommerce.com/boards/viewthread/198222/#t393368

祝你好运。