Jump to content
thirty bees forum
  • 0

Old PS Bug Carried Over? Add shop address to header in PDF invoice


basix101

Question

After copying the shop data over from PS 1.6 to TB 103 via MigrationPro module, the pdf invoices do not have the shop address in the header.

I found this fix but do not know how to follow the directions. Do I edit both files before putting the copy in /override/classes/pdf, or do I put the copy in before editing?

Not even sure the directions will work but posted it here in case it needs a permanent fix in TB.

Can someone please help me out. I have an invoice I have to print but it does not have the shop address in the header.

This is the code from:
http://angelwings.net/blog/prestashop-1-6-add-shop-address-to-header-in-pdf-invoice/

Prestashop 1.6: Add shop address to header in PDF invoice Posted on May 18, 2016 by admin ************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: psorderinvoice) 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 $shopname = Configuration::get(‘PSSHOPNAME’, null, null, $idshop);

Add

$shop_address = $this->getShopAddress();

Next, under ‘shopname’ => $shopname,

Add

‘shopaddress’ => $shopaddress,

2) Open /pdf/header.tpl

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

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

Adjust css styles as required.

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

Sure. I installed TB with Softaculous on a brand new host. I then imported customers, orders, categories, products etc; into TB with Prestashop MigrationPro. I don't think PS MigrationPro would have changed any classes/ controllers folders but I could be wrong.

I did add the shop address that was missing from the 'Contact information block v2.0.0 - by thirty bees' module, and I can't remember if it was enabled or not but it is enabled now. I am using the Warehouse Theme 'Contacts' module which had the correct address. After adding the address to the 'Contact information block v2.0.0 - by thirty bees" module and clearing the cache, the address appeared at the footer of the Invoice but not in the header. Maybe I need a new order to see if adding the address will appear in the header in a new order invoice?

Link to comment
Share on other sites

  • 0

I just did some testing myself, and found out a few things. Like you were saying, or the blog you posted, if you change your address on the site, you're old invoices won't have the new address on them, they will have the address at the time when they were created. So, I changed my address, looked at some old invoices, my addy wasn't on them. I made a new order, and my address was on that invoice. So.... I dunno what to tell ya,, I guess you could do what that blog suggested, modifying those files.

Link to comment
Share on other sites

  • 0

Hmmm.. That was already filled in. I'm hoping the TB Contacts module was the problem. Waiting for another order to see if the address is in the header. My first two orders came in together and I did not notice the address problem. I just printed the invoices and sent them off. It was only this third order that I noticed the address was not in the header or footer. Enabling and filling in the TB Contacts module got the address on the footer of that invoice, so I am hoping the address will be on the header and footer on the next fresh invoice,

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...