How to setting Prestashop Invoice Number for PDF without a module?
In default, Prestashop create an invoice PDF filename, invoice number… with format: #IN000001, #IN000002…
if you want change this formatting, you can use either of the ways:
1st way – best
Download & Install Prestashop Invoice & Delivery Slips, Credit Slips Template Builder with Custom Number Pro at here: https://buy-addons.com/store/prestashop/module/prestashop-invoice-template-builder-module.html
Use this module, you can change invoice number, delivery number, credit slip number from backoffice, no need modify any PHP file. Also you can design your PDF template file from Backoffice in this module.
2nd way – Good – Manual Edit PHP file, follow steps below:
In this post, Buy-Addons team will take to help you how to modify, change this format.
Step 1: change Disable all overrides to No
Go to Advanced Parameters > Performance, change Disable all overrides to No
Step 2: Download OrderInvoice.php.txt at here: OrderInvoice.php.txt
Rename this file to OrderInvoice.php, then upload this file to PRESTASHOP_ROOT\override\classes\order\OrderInvoice.php
Step 3: Open PRESTASHOP_ROOT\override\classes\order\OrderInvoice.php
Modify getInvoiceNumberFormatted() method, Prestashop use value that returned from this function to make Invoice Number.
Example 1: if we change this method to code
public function getInvoiceNumberFormatted($id_lang, $id_shop = null)
{
return ‘INVOICE-HELLO’;
}
All Prestashop Invoice PDF file in your store will have the same Invoice number is INVOICE-HELLO
Example 2: if we change this method to code:
public function getInvoiceNumberFormatted($id_lang, $id_shop = null)
{
return ‘INVOICE-‘.$this->id_order;
}
Invoice PDF number will have formatt: INVOICE-[order_id] as INVOICE-1, INVOICE-2…
Also you can open a PHP Class: PRESTASHOP_ROOT\classes\order\OrderInvoice.php in order to find variables, methods, functions that can use them in PRESTASHOP_ROOT\override\classes\order\OrderInvoice.php
Because PHP class PRESTASHOP_ROOT\override\classes\order\OrderInvoice.php extends from a class PRESTASHOP_ROOT\classes\order\OrderInvoice.php
Go to Prestashop Backoffice > Orders, view an Order Detail and see Invoice number changed:
Step 4: Download file HTMLTemplateInvoice.php_1359.txt at here: HTMLTemplateInvoice.php_1359.txt
Rename this file to HTMLTemplateInvoice.php, upload this file to: PRESTASHOP_ROOT\override\classes\pdf
Also you can open a PHP Class: PRESTASHOP_ROOT\classes\pdf\HTMLTemplateInvoice.php in order to find variables, methods, functions that can use them in PRESTASHOP_ROOT\override\classes\pdf\HTMLTemplateInvoice.php
Because PHP class PRESTASHOP_ROOT\override\classes\pdf\HTMLTemplateInvoice.php extends from a class PRESTASHOP_ROOT\classes\pdf\HTMLTemplateInvoice.php
Step 5: Go to Prestashop Backoffice > Orders, view an Order Detail and download Invoice PDF, you can see PDF file is changed
PDF filename is changed to new format:
Leave a reply
You must be logged in to post a comment.