Jump to content

[SOLVED] Edit Invoice PDF?


Recommended Posts

Hi,

 

I'm trying to make some small changes to the invoice PDF.

 

1) I use a Danish company for handling credit cards called ePay, but i donut want the payment method on the invoice listen as "ePay" but rather as "Credit card"

 

2) For some reason the tax is shown with 3 decimals, as opposed to all other prices that only have to decimals.. Don't know if their is a good reason for this but would like to change the tax field to only have 2 decimals.

Link to comment
Share on other sites

you could change the ePay payment module, so that the display name is "Credit Card", but unfortunately that breaks a validation check, so you would have to override the PaymentModule class.

 

you could also just change the PDF.php, so that instead of displaying "ePay", it converts it to "Credit Card".

 

I didn't follow you second item, perhaps a screen shot would help.

Link to comment
Share on other sites

Thanks for you reply!

 

So i locate the place in the PDF.php where it writes out the name of the payment method, check if it says "ePay" and if yes, replace it with "Credit card"?

 

Will give it a try :)

 

Here a screenshot to show what i mean about the decimals on Tax:

 

credit-slip.png

Link to comment
Share on other sites

Guess that changing the name from "ePay" to "Credit card" should be done in these lines of code.. But can't really figure out whats going on?

 

$pdf->Cell(55, 6, self::l('Order #').' '.sprintf('%06d', self::$order->id), 'L', 0);
 $pdf->Cell(70, 6, self::l('Carrier:').($order->gift ? ' '.Tools::iconv('utf-8', self::encoding(), $carrier->name) : ''), 'L');
 $pdf->Cell(0, 6, self::l('Payment method:'), 'LR');
 $pdf->Ln(5);
 $pdf->Cell(55, 6, (isset($shipping_date) ? self::l('Shipping date:').' '.Tools::displayDate($shipping_date, self::$order->id_lang) : ' '), 'LB', 0);
 $pdf->Cell(70, 6, ($order->gift ? self::l('Gift-wrapped order') : Tools::iconv('utf-8', self::encoding(), $carrier->name)), 'LRB');
 $pdf->Cell(0, 6, Tools::iconv('utf-8', self::encoding(), $order->payment), 'LRB');
 $pdf->Ln(15);
 $pdf->ProdTab((self::$delivery ? true : ''));

Link to comment
Share on other sites

This should be the line of code, The 3 after "$tax_rate" is how many decimals to use. Try changing the 3 to 2. The line of code is in the function called "TaxTab"

 

$this->Cell($w[1], $lineSize, number_format($tax_rate, 3, ',', ' ').' %', 0, 0, 'R');

 

Note: The correct way to make these changes is to create an override of the class. But for now, just get the code working how you like it, you can deal with overrides after.

Link to comment
Share on other sites

Thanks a lot!

 

- Now that i see it I'm actually a bit embraced that I didn't discover that myself :)

 

I know the correct way is to do an override but haven't quite learned how that works yet.. got to find a good tutorial :) - anyways.. Really appreciate the help i have gotten on this Forum! :)

Link to comment
Share on other sites

  • 3 weeks later...

you should really open a new topic for this new question.

 

address formats are controlled via the back office. go to Shipping | Countries. Edit the country in question, and update the address format so it does not include the State.

 

Note: This will impact the entire site, so anywhere that addresses are displayed, the State will no longer appear.

Link to comment
Share on other sites

Thanks for your help, but I need the State to show up everywhere in the site, except for the Pdf, so that wouldnt work...

Try to add 'State:name' to the array in PDF.php

   	
$patternRules = array(
			'avoid' => array(
				'address2',
				'company',
				'phone',
				'phone_mobile'));

I didn't test.

Edited by tuk66 (see edit history)
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...