Reputation: 1629
Does anyone know how I could add comments to orders in magento's order management area in admin and then have them print out on the invoices?
Thanks!
Upvotes: 3
Views: 5839
Reputation: 41
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 ***********************************/
Upvotes: 4
Reputation: 121
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.
Upvotes: 1
Reputation: 16845
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
Upvotes: 1