Magento-从后台管理员向发票添加评论


Magento - Add comments to invoice from back admin

有人知道我如何在管理员中的magento订单管理区域向订单添加注释,然后将其打印在发票上吗?

谢谢!

app/code/local/mage/sales/model/order/pdf/invoice.php

并在public function getPdf中添加以下代码主要在Add Total Code 之后

保存并下载PDF发票。。。。繁荣发票评论将在您的pdf中。。

/*************************** This Is The Invoice Comments ***********************************/
$this->_setFontRegular($page, 10);
// Begin table header
$page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
$page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
$page->setLineWidth(0.5);
$page->drawRectangle(25, $this->y, 570, $this->y -15);
$this->y -= 10;
$page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
// end table header

$_tempY = $this->y;
$commentsCollection = $invoice->getCommentsCollection(true);
$internalcomments = "Internal Invoice Comments";
$page->drawText($internalcomments, 35, $this->y, 'UTF-8');
$this->y -= 15;
foreach($commentsCollection as $comm)
{
        $textChunk = wordwrap($comm->getData('comment'), 120, "'n");
        foreach(explode("'n", $textChunk) as $textLine){
                if ($textLine!=='') {
                        $page->drawText(strip_tags(ltrim($textLine)), 35, $this->y, 'UTF-8');
                        $this->y -= 15;
                }
        }
 }
/*************************** End Invoice Comments ***********************************/

在Magento版本1.5.1.0中,已有可用选项。

转到

管理员->销售->订单

要查看订单,请单击特定订单。应该有"注释历史记录"。在这里,您可以向订单添加注释

创建发票后,转到特定发票。应该有一个"发票历史记录"。在这里,您可以将备注添加到发票中。

然后打印发票如果你愿意在打印输出中添加你的评论,这篇文章可以帮助你

所有最好的

您需要在发票、发货或贷项凭证模板中添加{{var comment}}。您可以访问Magento 1.5提供的默认模板,方法是转到系统>事务性电子邮件。

根据默认设置创建自己的模板后,请转到"系统">"配置">"销售电子邮件"。选择您刚刚创建并保存的模板。

{{var comment}}提供添加注释的选项。无论你键入什么,都会出现在新发票上。

希望这就是你的要求。