[Prestashop help] How to generate, modify Invoice, Delivery, Credit Slip, Supply Order, Return PDF files in Prestashop website?
The Prestashop website use tcpdf library (a PDF library use for creating a PDF file with PHP) allow to export invoice, delivery, credit slips, supply order into a PDF file for download & print it from your computer.
In this post, we will guide you how to generate a PDF from Prestashop Backoffice & Prestashop website. Also how to modify header, content, footer of a PDF file template.
1.How to generate an Invoice, Delivery PDF file from Backoffice & Prestashop website?
In Backoffice:
- Go to Orders Management, click Invoice, Delivery icon in PDF column
- Or view an Order Detail, click Invoice, Delivery icon in Top-Left screen
In Prestashop website, log in your account:
- Go to Your account > Order History & Details
- Or go to Your account > Order History & Details, View a Detail of Order
Note: The Prestashop does not allow export a Delivery PDF in your website, Only admin can use this feature.
2.How to generate a Credit Slips PDF file from Backoffice & Prestashop website?
In Backoffice
Go to Orders > Credit Slips, download PDF file from PDF column
In Prestashop website
Go to Your account > Credit Slips, click PDF icon to download Credit Slips file
3.How to generate a Supply Order PDF file from Backoffice?
In Prestashop 1.7, it does not included Supply Order PDF in it’s core
Step 1: you must enabled Enable advanced stock management for use Supply Order function.
Go to Preferences > Products, change Enable stock management = Yes, Enable advanced stock management = Yes, New products use advanced stock management = Yes (optional)
Step 2: Go to Stock > Supply orders, click Print icon to download PDF for a Supply order
4.How to generate a Order Return PDF file from Backoffice?
Step 1:
- In Prestashop 1.6, go to Orders > Merchandise Returns
- In Prestashop 1.7+, go to Customer Service > Merchandise Returns
Step 2:
if Status is Waiting for package, you can download a PDF file in Returns form or Return slip field
5. How to customize a PDF template file?
Go to PRESTASHOP_ROOT/pdf, find a *.tpl file that you want customize it
- *.tpl files for make an Invoice PDF: header.tpl, footer.tpl, invoice***.tpl
- *.tpl files for make a Delivery PDF: header.tpl, footer.tpl, delivery-slip***.tpl
- *.tpl files for make a Credit Slips PDF: header.tpl, footer.tpl, order-slip***.tpl
- *.tpl files for make a Order Return PDF: header.tpl, footer.tpl, order-return***.tpl
- *.tpl files for make a Supply Order PDF: supply-order***.tpl
You can modify HTML, CSS from there *.tpl files with Smarty language
6. How to assign new values from PHP file to PDF file in order to print it?
Step 1: find a Entry PHP Class file that executed to generate your PDF file.
- invoice** tpl: Entry PHP class is PRETSASHOP_ROOT\override\classes\pdf\HTMLTemplateInvoice.php or PRETSASHOP_ROOT\classes\pdf\HTMLTemplateInvoice.php
- delivery-slip** tpl: Entry PHP class is PRETSASHOP_ROOT\override\classes\pdf\HTMLTemplateDeliverySlip.php or PRETSASHOP_ROOT\classes\pdf\HTMLTemplateDeliverySlip.php
- order-slip** tpl: Entry PHP class is PRETSASHOP_ROOT\override\classes\pdf\HTMLTemplateOrderSlip.php or PRETSASHOP_ROOT\classes\pdf\HTMLTemplateOrderSlip.php
- order-return** tpl: Entry PHP class is PRETSASHOP_ROOT\override\classes\pdf\HTMLTemplateOrderReturn.php or PRETSASHOP_ROOT\classes\pdf\HTMLTemplateOrderReturn.php
- supply-order*** tpl: Entry PHP class is PRETSASHOP_ROOT\override\classes\pdf\HTMLTemplateSupplyOrderForm.php or PRETSASHOP_ROOT\classes\pdf\HTMLTemplateSupplyOrderForm.php
Step 2: Open a Entry PHP Class, for an example we open file HTMLTemplateInvoice.php, each Entry PHP class extends from HTMLTemplate.php and it always have 3 main functions
- getHeader(): Assign data and execute to get the header of PDF file
- getFooter(): Assign data and execute to get the header of PDF file
- getContent(): Assign data and execute to get the header of PDF file
if you want assign new values from PHP to *.tpl PDF template file, you can use this function of Smarty
$this->smarty->assign(‘new_variable’, ‘new value’);
Example my image
Step 3: Open a *.tpl PDF file in PRESTASHOP_ROOT/pdf, print new value with statement:
{$new_variable1}
Our sample source code:
7. Use an External Prestashop invoice module
You can try to use our Prestashop Invoice & Delivery Slips, Credit Slips Template Builder with Custom Number Pro module at here: https://buy-addons.com/store/prestashop/module/prestashop-invoice-template-builder-module.html
This module can help you modify invoice, delivery, credit slips, supply order PDF file from Prestashop backoffice. Also it have 18 professional PDF template as well !!!
Leave a reply
You must be logged in to post a comment.