如何在 \app\code\local\Mage\Sales\Model\Order\Pdf\Abstract.php 中显示发票 ID
我不需要显示getRealOrderId()
在 pdf 发票中,但我需要发票 ID。
我怎样才能做到这一点?
首先确保您的订单已加载……看看:
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
祝你好运。