Home web designing prestashop Prestashop Solution-2 Steps To Insert Vat Number In Invoice

Prestashop Solution-2 Steps To Insert Vat Number In Invoice

0

Insert Vat Number In Prestashop Invoice

Prestashop use smarty files . So you can’t insert VAT number on invoice with just doing html changes. To insert it you must have to make changes in smarty files also .To Insert VAT number on prestashop pdf invoice you have to follow these 2 simple steps .

  1. Insert Vat number in HTMLTemplateinvoice.php
  2. Get itr in the invoices.tpl

Step 1 Insert Vat number in HTMLTemplateinvoice.php

Login to cpanel . Then go to File manager.

File manager In cPanel
File manager In cPanel

Under the  prestashop installation folder locate the folder name “classes” and open it . Under the classes folder open the folder name “pdf” .

Then locate the file “HTMLTemplateinvoice.php” .  Right click on it and click on code edit . Locate the following function in the file .

public function getContent()
{
...
  $data = array(
    'order' => $this->order,
    'order_details' => $this->order_invoice->getProducts(),
    'cart_rules' => $this->order->getCartRules($this->order_invoice->id),
    'delivery_address' => $formatted_delivery_address,
    'invoice_address' => $formatted_invoice_address,
    'tax_excluded_display' => Group::getPriceDisplayMethod($customer->id_default_group),
    'tax_tab' => $this->getTaxTabContent(),
    'customer' => $customer
  );
...

And just add the following code in the function as highlighted in the text .Save file to make changes . In the code insert the code ‘vat_number’ => ‘123456’, . Change 123456 with your VAT number as shown in the following code .

public function getContent()
{
...
  $data = array(
    'vat_number' => '123456',  (use your own number...)
    'order' => $this->order,
    'order_details' => $this->order_invoice->getProducts(),
    'cart_rules' => $this->order->getCartRules($this->order_invoice->id),
    'delivery_address' => $formatted_delivery_address,
    'invoice_address' => $formatted_invoice_address,
    'tax_excluded_display' => Group::getPriceDisplayMethod($customer->id_default_group),
    'tax_tab' => $this->getTaxTabContent(),
    'customer' => $customer
  );
...

Step 2 Get it in the invoices.tpl

After that go to the next step . Open the pdf folder . But At this time open the pdf folder under the root folder of prestashop instead of classes > pdf .

Then locate the file invoice.tpl and right click on it to edit it . Select code edit . After that place the following code where you want to insert the VAT number .

  <b>{l s='VAT Number:' pdf='true'}</b><br />
  {$vat_number}<br />
  <br />

Suppose you want to insert the it before the store address then copy and paste this code before {$addresses_tab} . Save the changes and refresh the page . Go back to prestashop dashboard and check the invoice again . VAT number in now displaying on the invoice .

Note : This method use only if you want to insert a fixed VAT number on all invoices .