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

Custom PDF Invoice name
 
atlantide
Sr. Member
 
Avatar
Total Posts:  187
Joined:  2008-02-16
France
 

how do I custom the name of the PDF invoice?

Thank you for all

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sipke
Jr. Member
 
Total Posts:  10
Joined:  2008-03-26
 

I would like to know this also! wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
atlantide
Sr. Member
 
Avatar
Total Posts:  187
Joined:  2008-02-16
France
 

Maybe anybody would have an answer ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
atlantide
Sr. Member
 
Avatar
Total Posts:  187
Joined:  2008-02-16
France
 

Does anyone have now an idea ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
atlantide
Sr. Member
 
Avatar
Total Posts:  187
Joined:  2008-02-16
France
 

I found the answer :

app/code/core/adminhtml/controllers/sales/InvoiceController.php

line 401 :

$this->_prepareDownloadResponse('invoice'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').'.pdf'$pdf->render(), 'application/pdf');

there is the same line in :
app/code/core/adminhtml/controllers/sales/order/InvoiceController.php

line 78 and 100. For these lines, I don’t know when they are used but I guess they need to be changed also.

you will get more info about date format at :
http://www.phpbuilder.com/manual/function.date.php

(this could help some people, I didn’t know anything about date function before for myself)

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
Total Posts:  368
Joined:  2008-04-10
 

go to : app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php

$page->drawText(Mage::helper('sales')->__('PUT YOUR CUSTOM NAME HERE'), 35$this->y'UTF-8');

you can change the content of it,.....

 
Magento Community Magento Community
Magento Community
Magento Community
 
atlantide
Sr. Member
 
Avatar
Total Posts:  187
Joined:  2008-02-16
France
 

Thank you for your anwer

Just a question : do you know the difference between our two methods ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
Total Posts:  368
Joined:  2008-04-10
 

hi @atlantide,

I don’t know what you are going to change at InvoiceController.php, but at controller you call a function

but at invoice.php you change its content

 
Magento Community Magento Community
Magento Community
Magento Community
 
atlantide
Sr. Member
 
Avatar
Total Posts:  187
Joined:  2008-02-16
France
 

Am I also able to use custom date as for the default method ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
Total Posts:  368
Joined:  2008-04-10
 

I’m sorry , I don’t get it ? by use custom date ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
atlantide
Sr. Member
 
Avatar
Total Posts:  187
Joined:  2008-02-16
France
 

Excuse me :

how do I insert the date in the pdf invoice name ?

Do I use the same code than for my methode ?

Mage::getSingleton('core/date')->date('Y-m-d_H-i-s')
 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
Total Posts:  368
Joined:  2008-04-10
 

yes

anyway , at app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php, it only change its content,

and yes, you can insert what ever you like using

$page->drawText(Mage::helper('sales')->__('PUT YOUR CUSTOM NAME HERE'), 35$this->y'UTF-8');

eg

$page->drawText(Mage::helper('sales')->__('TIME IS : ' Mage::getSingleton('core/date')->date('Y-m-d_H-i-s')), 35$this->y'UTF-8');
 
Magento Community Magento Community
Magento Community
Magento Community
 
Kerry Hatcher
Sr. Member
 
Avatar
Total Posts:  96
Joined:  2008-07-15
Macon, GA
 

I think I see how to put my own text in the invoice but how would I put a logo image?

Thanks,

 
Magento Community Magento Community
Magento Community
Magento Community
 
atlantide
Sr. Member
 
Avatar
Total Posts:  187
Joined:  2008-02-16
France
 

Take a look in the configuration :
Sales / Sales under “Invoice and Packing Slip Design”

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top