magento发票定制
magento invoice customization
我正在尝试修改客户下订单时生成的发票,到目前为止,我已经生成了客户将随礼物附上并更改其位置的消息,但我想同时显示发票号并与它一起编辑其他组件。
$message = Mage::getModel('giftmessage/message');
$gift_message_id = $invoice->getOrder()->getGiftMessageId();
if(!is_null($gift_message_id)) {
$message->load((int)$gift_message_id);
$gift_sender = $message->getData('sender');
$gift_recipient = $message->getData('recipient');
$gift_message = $message->getData('message');
$page->drawText(Mage::helper('sales')->__($gift_sender), 275, $this->y, 'UTF-8');
$this->y -=10;
$page->drawText(Mage::helper('sales')->__($gift_recipient), 275, $this->y, 'UTF-8');
$this->y -=20;
$page->drawText(Mage::helper('sales')->__($gift_message), 275, $this->y, 'UTF-8');
}
这是调用发票号的代码,如何在上面的代码中添加。
$this->insertDocumentNumber(
$page,
Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
);
您是否将上述代码置于 foreach
循环中?
foreach ($invoices as $invoice) {
}
如果是这种情况,您可以直接使用上面提到的代码
$this->insertDocumentNumber(
$page, Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
);
你可以看到上面的代码只是插入从 $invoice->getIncrementId()
检索到的增量 id 并将其放在 $page
.
如果不遵循 protected function _drawHeader(Zend_Pdf_Page $page)
的用法,那 file.This 会给你提示。
希望这会有所帮助。
我正在尝试修改客户下订单时生成的发票,到目前为止,我已经生成了客户将随礼物附上并更改其位置的消息,但我想同时显示发票号并与它一起编辑其他组件。
$message = Mage::getModel('giftmessage/message');
$gift_message_id = $invoice->getOrder()->getGiftMessageId();
if(!is_null($gift_message_id)) {
$message->load((int)$gift_message_id);
$gift_sender = $message->getData('sender');
$gift_recipient = $message->getData('recipient');
$gift_message = $message->getData('message');
$page->drawText(Mage::helper('sales')->__($gift_sender), 275, $this->y, 'UTF-8');
$this->y -=10;
$page->drawText(Mage::helper('sales')->__($gift_recipient), 275, $this->y, 'UTF-8');
$this->y -=20;
$page->drawText(Mage::helper('sales')->__($gift_message), 275, $this->y, 'UTF-8');
}
这是调用发票号的代码,如何在上面的代码中添加。
$this->insertDocumentNumber(
$page,
Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
);
您是否将上述代码置于 foreach
循环中?
foreach ($invoices as $invoice) {
}
如果是这种情况,您可以直接使用上面提到的代码
$this->insertDocumentNumber(
$page, Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
);
你可以看到上面的代码只是插入从 $invoice->getIncrementId()
检索到的增量 id 并将其放在 $page
.
如果不遵循 protected function _drawHeader(Zend_Pdf_Page $page)
的用法,那 file.This 会给你提示。
希望这会有所帮助。