This questions was originally posted on stackoverflow but I got no responses. But I still need a help solving this problem I've been having.
I have installed Magemaven OrderComment into my CE 1.8.0 and it works fine on both front and back end but wated to show thoes comment when we print invoices. I have been googling and searching but none is working so far.
I found below codes from Magento forum:
foreach ($invoices as $invoice) { $comments = $invoice->getCommentsCollection()->getItems(); foreach ($comments as $comment) { print_r($comment->getData()); //echo $comment->getData('comment'); //echo $comment->getData('created_at'); } } and
/*************************** 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); $orderComment = "Order Comments"; $page->drawText($orderComment, 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 ***********************************/ Tried each code into the same place after:
/* Add totals */ $this->insertTotals($page, $invoice); if ($invoice->getStoreId()) { Mage::app()->getLocale()->revert(); } } in code/core/Mage/Sales/Model/Order/Pdf/Invoice.php file. But no luck. (Second code was able to show title for Order Comment in PDF but not actual comments) Even tried "ordercomment", "OrderComment" or "customer_note" instead of "comment" but nothing showed on PDF invoice.
Surprisingly to see on those forums no one actually figure out, or I just couldn't find the right answer?
As our shop needs to show these comments to a courier, it really helps speed up our whole process. I desperately need you these geniuses help in this forum!
Thanks in advance!

