Jump to content

Overriding PDF invoices


Recommended Posts

Hello all

I had a quick best practice question. I am modifying invoice tpl files in the "pdf" folder. What is the best way of doing this? just change the tpl files in that folder or can I do an override somewhere safer? I have been looking online but cannot see a definite answer. I see how to override existing modules, even core controller files, but not sure about the pdf. Can I just copy the pdf folder to my own module's override folder? (which I prefer) or prestashop's override folder? Adding it to the theme's folder makes me think I could potentially lose my changes if the theme has an update.

Any advice would be greatly appreciated as to where exactly to put my modified pdf tpl files.

Best wishes

Nima

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 3 years later...

I'm reviving this topic because I think both answers given before are wrong. Maybe they are outdated?

From the Prestashop Dev Doc:

Customize the PDF files templates
All PDF generated by PrestaShop are using Smarty templates and TCPDF as PDF rendering engine.

You will find all theses templates in the pdf folder, for each use case managed natively by the Core.

You can alter the Core files OR override them by copying them on themes/<your-theme>/pdf folder.

It’s not possible to override a PDF template in a module.

You can see more info here on how to customize the PDF template here: https://devdocs.prestashop.com/1.7/modules/concepts/pdf/

 

So to sum up:

  • You can override the template files by copying them in your theme /php folder
  • You can't edit the templates from a module

 

Hope it will help someone.

Good luck! ;-)

  • Like 2
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...