Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Print Invoice Comment in Invoice PDF
 
netsocial
Jr. Member
 
Total Posts:  7
Joined:  2008-03-12
 

Some invoices have special payment details or information that I would like to appear on the PDF printed version. 

These messages are currently being entered as a comment on the “Invoice” page when I create the invoice for an order.

How do I call this information so that I can include it in Mage/Sales/Model/Order/Pdf/Invoice.php ?

I’d like to see something like “Comments: “whatever i entered on the invoice comment field"” appear at the bottom of my invoice.  I’m already comfortable manipulating Zend PDF, I just need the data for Invoice Comment from Magento.

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
nmritten
Jr. Member
 
Total Posts:  3
Joined:  2009-03-15
 

Bump. I would also like to know how to do this. I tried messing around with my Abstract & Invoice files, but to no avail.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SBC Fulfillment
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2009-07-06
 

Bump.  Trying to do the same thing here.

 
Magento Community Magento Community
Magento Community
Magento Community
 
flmag
Member
 
Total Posts:  49
Joined:  2008-12-08
 

in Mage/Sales/Model/Order/Pdf/Invoice.php you can get the comments with something like this:

$commentsCollection $invoice->getCommentsCollection(true);
$commentsArray = array();
foreach(
$commentsCollection as $comm){
   $commentsArray[] 
$comm->getData('comment'));
}
And you’ll get an array containing all the comments for the invoice
 
Magento Community Magento Community
Magento Community
Magento Community
 
SBC Fulfillment
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2009-07-06
 

Awesome, thank you! 

Here’s what I ended up using to append the comments to the bottom left of the invoice.  I put it in right after the Add Totals section and used $this->y to set the alignment:

$commentsCollection $invoice->getCommentsCollection(true);
            
$commentsArray = array();
            
$this->_setFontRegular($page);
            foreach(
$commentsCollection as $comm)
            
{
                $page
->drawText($comm->getData('comment'), 35$this->y'UTF-8');
                
$this->-= 10;
            
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top