News:

Support the VirtueMart project and become a member

Main Menu

Overide pdf invoice

Started by uschmi, March 31, 2012, 21:24:22 PM

Previous topic - Next topic

uschmi

Could someone give me a hint where to override the header and footer of the pdf invoice?
I could easily do this for the body in invoice_items.php and invoice_order.php, but I didn´t found the place where to change to output of the header and footer.
Thanks in advance

uschmi


jjk

Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

uschmi

Unfortunately there is no hint how to override header/footer in these threads.
Any other ideas?

jjk

What exactly do you want to change? The layout or just the information in header and footer?
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

uschmi

Information & layout have to be changed in header+footer.
In germany,  you have to insert informations as f.ex. your adress, tax ident number aso. by law!
In addition, it´s usual to have the banking account informations and logo in the header or footer.

jjk

I think primarily you just have to enter your vendor information into 'Shop' - 'Vendor' view in the backend. Header logo must be a jpg image currently. (tcpdf has a problem with png image files). You can place your bank account information into the 'Description' filed for example.

Personally, I would label the outgoing e-mail to "Auftrags-  oder Bestellbestätigung" instead of "Rechnung", because as far as I know the information required in invoices by the 'Umsatzsteuergesetz" doesn't have to be provided in a "Auftragsbestätigung". Also if you email "invoices" right away, the invoice date might not match the date when you actually mail the ordered items.

If you need to alter the code, the relevant files which get rendered by tcpdf are in ...\components\com_virtuemart\views\invoice\tmpl\***.php
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

uschmi

I know that I can change the BODY-code in ...\components\com_virtuemart\views\invoice\tmpl\***.php.
But there is no possibility to change code for header/footer!!!

jjk

I currently can't play with tcpdf output because my VM2 SVN version has an issue with that.
Your last post sounds like you are looking for these files  ;) :
...\libraries\tcpdf\tcpdf.php
...\libraries\tcpdf\config\tcpdf_config.php
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

uschmi

I tried with $pdf->setPrintHeader(false); and even tried to manipulate tcpdf.php with no success.
$pdf->setPrintHeader(false); had no effect at all.
By manipulating tcpdf.php I could get a blank header, but I could remove the header-area.

This is essential for german users, because in Germany, you are forced to have several information about your company (as f.ex. tax id...) on your invoice.

Anyone with a solution/idea?

alf1234

i think you should be able to modify the pdf file in:
/components/com_virtuemart/views/invoice/tmpl/invoice.php
it also grabs info from variables set in:
/components/com_virtuemart/views/invoice/view.html.php
such as vendorAddress which is what gets put into your header (the bit you are trying to change).

The problem i have, is you can't override the pdf template. don't know why. if anyone has a solution i would love to know. all the other files in the invoice folder work with override (ie the mail_html_xxxxxxxxx.php files all override perfectly, but the invoice_xxxxxxx.php files dont work with overrride)

malaclypse

#11
I can confirm that it is possible to override the mail_html_*.php files in the invoice folder as alf1234 described.

However I'm having a similar issue with invoice_*.php files. The override only works for the pdfs generated in the backend (Orders&Shoppers->Orders->Invoice Button). It does not work for the automatically generated invoice pdfs (attached to the mails) which are sent if an order is set to confirmed.

Joomla 2.5.6 VM 2.0.6

c.media

in www\components\com_virtuemart\controllers\invoice.php

search :
$view->addTemplatePath( JPATH_VM_SITE.DS.'views'.DS.'invoice'.DS.'tmpl' );

and replace it by :

$application = JFactory::getApplication();
$templateName = $application->getTemplate();
               
$TempateViewsFolder = JPATH_SITE.DS."templates".DS.$templateName.DS."html".DS."com_virtuemart".DS."invoice";
if(file_exists($TempateViewsFolder)){
$view->addTemplatePath( $TempateViewsFolder);
} else{
$view->addTemplatePath( JPATH_VM_SITE.DS.'views'.DS.'invoice'.DS.'tmpl' );
}

c.media

sorry

does not work with template name variable but just if it's name is directly gived, i'll post later a better solution

c.media

for the moment, only by hacking :

$templateName = "Put your template name";
$view->addTemplatePath( JPATH_SITE.DS."templates".DS.$templateName.DS."html".DS."com_virtuemart".DS."invoice");

and copy all the invoice views files in the correct template overwrite directory to make it works