简体   繁体   English

magento发票定制

[英]magento invoice customization

I am trying to modify the invoice generated when a customer places an order, so far I have generated the message a customer would attached along the gift and change its position, but i want to display the invoice number along with it and edit other components along with it. 我正在尝试修改客户下订单时生成的发票,到目前为止,我已经生成了一条消息,要求客户将其附加在礼品上并更改其位置,但是我想显示发票编号以及与之一起编辑其他组件用它。

$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 is the code calling the invoice number, how do i add it in the above code. 这是调用发票编号的代码,我如何在上面的代码中添加它。

$this->insertDocumentNumber(
            $page,
            Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
        );

Have you placed the above mentioned code inside the foreach loop? 您是否已将上述代码放入foreach循环中?

foreach ($invoices as $invoice) {
}

If this is the case than you can directly use the code that you have mentioned above 如果是这种情况,那么您可以直接使用上面提到的代码

$this->insertDocumentNumber(
                    $page, Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId()
            );

You can see the above code just inserting the increment id retrieved from $invoice->getIncrementId() and placed it in $page . 您可以看到上面的代码,只需插入从$invoice->getIncrementId()获取的增量id并将其放在$page

If not than follow the use of protected function _drawHeader(Zend_Pdf_Page $page) in that file.This will give you the hint. 如果不是,请遵循该文件中protected function _drawHeader(Zend_Pdf_Page $page) ,这将为您提供提示。

Hope this will help. 希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM