开发者

Magento - Add comments to invoice from back admin

开发者 https://www.devze.com 2023-03-11 19:17 出处:网络
Does anyone know how I could add comments to orders in magento\'s order management area in admin and then have them p开发者_如何转开发rint out on the invoices?

Does anyone know how I could add comments to orders in magento's order management area in admin and then have them p开发者_如何转开发rint out on the invoices?

Thanks!


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

and add the following code inside public function getPdf mostly after Add Total Code

Save it and download PDF invoice ....boom invoice comment will be there in your 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 ***********************************/


In Magento ver. 1.5.1.0.options already available.

Goto

admin->sales->orders

to view the orders.click the particular order.There should be "Comments History".Here you can add comments to the order

Once you create the Invoice go to particular invoice.There Should be a "Invoice History".Here you can add your comments to your invoice.

Then print invoice If you willing to add your comments in printout this article could help you

All the best


You need to add {{var comment}} in the Invoice, Shipment or Credit Memo template. You can access default templates provided by Magento 1.5 by going to systems>Transactional Emails.

Once you create your own template based on default, go to Systems>Configuration>Sales Email. Select the template you have just created and save.

{{var comment}} gives you option to add comments. Whatever you type will apear on the new invoice.

Hope thats what you were asking for.

0

精彩评论

暂无评论...
验证码 换一张
取 消