gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 00:36:31 25 4
gpt4 key购买 nike

有谁知道如何在管理员的 magento 订单管理区域中为订单添加评论,然后将它们打印在发票上?

谢谢!

最佳答案

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

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

之后

保存并下载 PDF 发票....boom 发票评论将出现在您的 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 ***********************************/

关于php - Magento - 从后台管理员向发票添加评论,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6285518/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com