Jump to content

How to Add Order Number {$order->getUniqReference()} into Invoice's Header.tpl


Precision_Sam

Recommended Posts

Hello, 

I am trying to customize the invoice template (PS 17). I'd like to have righ up corner of the invoice showing:

Order #:

Order Date:

Invoice #

The invoice.summary-tab.tpl can show the order number by using {$order->getUniqReference()}.

Where should I modify if I want to add {$order->getUniqReference()} (or something similar to get order#) into header.tpl? What is the better to do that?  Any suggestion is very appreciated!  Thank you!

--Sam

image.png.bbd03fdba7662b5f9d597cb980ae6417.png

 

image.png.966ed36fa442ff8a2ee0c3048b347b8c.png

 

Link to comment
Share on other sites

First you need to add it into the getHeader method of the HTMLTemplateInvoice class (classes/pdf/HTMLTemplateInvoice.pdf)

public function getHeader()
    {
        $this->assignCommonHeaderData();
        $this->smarty->assign(['header' => Context::getContext()->getTranslator()->trans('Invoice', [], 'Shop.Pdf')]);
        $this->smarty->assign(['order_reference' => $this->order->reference]); /* add this line! */

        return $this->smarty->fetch($this->getTemplate('header'));
    }

Then you can use {$order_reference} in header.tpl

Edited by lordignus
clarity (see edit history)
  • Like 2
Link to comment
Share on other sites

  • 9 months later...

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...