Precision_Sam Posted November 3, 2022 Share Posted November 3, 2022 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 Link to comment Share on other sites More sharing options...
lordignus Posted November 3, 2022 Share Posted November 3, 2022 (edited) 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 November 3, 2022 by lordignus clarity (see edit history) 2 Link to comment Share on other sites More sharing options...
Precision_Sam Posted November 4, 2022 Author Share Posted November 4, 2022 Thank you very much! It's working now. Link to comment Share on other sites More sharing options...
c64girl Posted August 22, 2023 Share Posted August 22, 2023 (edited) For people that want add to invoice a order ID just do $this->smarty->assign(['order_reference' => $this->order->id]); Edited August 22, 2023 by c64girl (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now