Jump to content

PDF invoice customisation


Recommended Posts

Hi Guys,

I need your help as I'm no programmer and I know nothing about coding. Also I'm pretty new to prestashop and similar e-commerce shops.
I need to customize the information in the invoice. I searched around but I couldn't have related topic.
The problem is that the invoice is using the website logo, however I want to put the company name which is deferent from the website. Also I need to have the company ID in the invoice.

I'd appreciate any help (simplified help) so I can apply myself.

Thank you very much

Sami

Link to comment
Share on other sites

You need to edit classes/PDF.php. You can change the logo on lines 139-140 (in PrestaShop v1.3.1):

if (file_exists(_PS_IMG_DIR_.'/logo.jpg'))
   $this->Image(_PS_IMG_DIR_.'/logo.jpg', 10, 8, 0, 15);



This code loads your website's logo if it exists. You can change link from logo.jpg to something like logo_pdf.jpg and upload that image to the img directory in the root of your PrestaShop.

PrestaShop uses FPDF to write its PDFs. You can read more about it here. You'll need to add a new $this->Cell() function call to add your company ID. The first parameter is the cell width, the second the cell height and the third is the text to display.

Link to comment
Share on other sites

  • 3 months later...

Hi, I have tried to change the logo according to these instructions but all it does is give me an error message:

FPDF error: Some data has already been output, can't send PDF file

Nothing I do makes any difference - I just have to put the original file back. Why is the pdf file so difficult to edit?

Link to comment
Share on other sites

Yes, I did that - exactly as described in this post. I added one jpg image to the same folder, exactly the same size as the original and just changed the name. I also changed the name in the pdf.php file as described. But it doesn't work - just gives this error.

Link to comment
Share on other sites

Exactly the same as yours.

I made a test just to check and I realise that even if I download the file to my desktop and then re-upload the same file by ftp, without any changes whatsoever, it gives me this error. So for some reason this file just does not like to be touched.

I have tried to delete the file via ftp and reupload the new one; upload it as a text file and then change to php. But the only file that produces a pdf invoice is the original pdf.php file that I backed up.

I'm baffled and frustrated.

Link to comment
Share on other sites

hmm, maybe a permission error.
if you use filezilla you can see if the file has server rights or not.
i have it on one shared package where the rights gets fxckxd up sometimes.
Or you uploaded it as ascii or binary, do not remember right now which way it should be, as i'm on a guest pc with no filezilla installed.

Link to comment
Share on other sites

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...