How to setup custom header for invoices and Delivery Slips

In Prestashop as we all know there is the possibility to have a pdf version of the invoice and the delivery slip, but it looks like that by default both uses the same tpl header.

How to create 2 separate headers in this case? Here is the solution:

I decided to keep the original one, header.tpl as header for invoices so I created a new tpl file: delivery-slip.header.tpl that I will use only for Delivery Slips;

Locate HTMLTemplateDeliverySlip.php file under classes/pdf and create a copy with the same name a paste it into: override/classes/pdf folder

Remember, if you want to edit some of the existing classes always create a copy of the file and put it under Override folder!

Open the newly created HTMLTemplateDeliverySlip.php file and go to row 66 (or somewhere there around) you will see something like:

return $this->smarty->fetch($this->getTemplate('header'));

As you see this Delivery Slip template, by default uses the same header as per the invoices!

Now change this row into:

return $this->smarty->fetch($this->getTemplate('delivery-slip.header'));

We are basically saying now to this class to use our new tpl file called: delivery-slip.header.tpl

– Edit the file as you wish, clear the cache in Prestashop Admin, and that’s it, you have now two separate headers for Invoice and Delivery Slip PDFs.