Prestashop 1.6: Add shop address to header in PDF invoice

************IMPORTANT NOTE*************
ISSUE: Shop address at the top of current customised PDF invoice doesn’t seem to be updated when address is changed to a new one via Backoffice.
The order invoice’s shop address data is added to the database (TABLE: ps_order_invoice) upon creation under the “shop_address” field.
Changing the following will not update old invoice entries
1) Backoffice, Preferences > Store Contacts or
2) Modules Custom Contact Page (Warehouse)
It will only affect new invoice entries.

When using the same code in the footer.tpl on header.tpl, the shop address doesn’t show up. This is because the header function that loads the header data doesn’t contain the code to retrieve the shop address. The following will add the code to do so.

1) Copy /classes/pdf/HTMLTemplate.php (and put the copy in /override/classes/pdf)

go to public function assignCommonHeaderData()

Under $shop_name = Configuration::get(‘PS_SHOP_NAME’, null, null, $id_shop);

Add

$shop_address = $this->getShopAddress();

Next, under ‘shop_name’ => $shop_name,

Add

‘shop_address’ => $shop_address,

2) Open /pdf/header.tpl

Remove {$shop_name|escape:’html':’UTF-8′}

Add {$shop_address|escape:’html':’UTF-8′}

Adjust css styles as required.

This entry was posted in ecommerce and tagged , , . Bookmark the permalink.

Comments are closed.