Jump to content

Prestashop 1.6.1.14 - Overriding HTMLTemplate.php


Recommended Posts

I am trying to override a PDF class called HTMLTemplate.php which is displaying a .tpl file called footer.tpl. I have created a custom module and create a file as such.

module/<mymodule>/override/class/pdf/HTMLTemplate.php

Code content:

<?php
class HTMLTemplate extends HTMLTemplateCore
{
 	 /**
     * Returns the template's HTML footer
     *
     * @return string HTML footer
     */
    /*
    * module: customfooter
    * date: 2017-11-14 16:57:22
    * version: 1.0
    */
    public function getFooter()
    {
        $shop_address = $this->getShopAddress();
        $id_shop = (int)$this->shop->id;
        $this->smarty->assign(array(
            'available_in_your_account' => $this->available_in_your_account,
            'shop_address' => $shop_address,
            'shop_fax' => Configuration::get('PS_SHOP_FAX', null, null, $id_shop),
            'shop_phone' => Configuration::get('PS_SHOP_PHONE', null, null, $id_shop),
            'shop_email' => Configuration::get('PS_SHOP_EMAIL', null, null, $id_shop),
            'free_text' => Configuration::get('PS_INVOICE_FREE_TEXT', (int)Context::getContext()->language->id, null, $id_shop)
        ));
        return $this->smarty->fetch($this->getTemplate('footer'));
    }
}

I would like it to read from another .tpl file which I will replace footer.tpl. I intend to customize the footer better. It is currently giving me a 500 error when I click "View Invoice".

Can anyone advise me?

Thank you.

Edited by Enthu86 (see edit history)
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...