AlanHogg Posted June 26, 2017 Share Posted June 26, 2017 Hello, When I generate a pdf invoice it shows an invoice no. that goes up in increments of 1 for each invoice generated. So if an invoice isn't generated for a certain order the next one generated is out of sync (i.e. dosent match the order id in the back office). Is there a simple way to pull in the order id as the invoice no. on the template so the invoice number is the same as the order id?? I understand it will involve changing the invoice.tpl and header.tpl files, I just don't know what to change the 'call' to?! If anyone can help it will be massively appreciated!! Link to comment Share on other sites More sharing options...
Scully Posted June 26, 2017 Share Posted June 26, 2017 (edited) Your are correct. I think it would be header.tpl for your invoice. There you can replace {$title|escape:'html':'UTF-8'} with {$order->id} The corresponding title should be around line 43 within that file. However, If you intend to do the change within header.tpl it is possible, that the full order information is not available at that point. If you don't get a value, you have to change the file HTMLTemplate.php which is located in the path /classes/pdf There, you have to enhande the function assignCommonHeaderData() to load the full order object. I probably wouln't go this approach. Instead, you could transfer the contents of your header.tpl to the files invoice.tpl and delivery-slip.tpl. So header.tpl would be an empty file and the header comes directly from the two other involved sources. Why:In the body part (invoice.tpl or delivery-slip.tpl) you have access to almost all data available for orders. That is the difference to the header-function which only loads a very small part of smarty variables. So a change of the HTMLTemplate.php should not be necessary. Good luck. Edited June 26, 2017 by Scully (see edit history) Link to comment Share on other sites More sharing options...
AlanHogg Posted June 26, 2017 Author Share Posted June 26, 2017 Scully, thank you so much for you're comprehensive, clear advice. I have pulled the order id successfully into the invoice.tpl file. Many thanks for your help Link to comment Share on other sites More sharing options...
Scully Posted June 26, 2017 Share Posted June 26, 2017 Good to hear. Thank you for the feedback. Link to comment Share on other sites More sharing options...
AlanHogg Posted June 26, 2017 Author Share Posted June 26, 2017 Scully, don't mean to be cheeky but... Do you know the 'call' to bring in the order id into order history (history.tpl) to replace the order reference. We are trying to achieve the same result as with the pdf invoices previously. Many thanks for your time Link to comment Share on other sites More sharing options...
Scully Posted June 26, 2017 Share Posted June 26, 2017 In history.tpl around line 60 you shoud find this line: {Order::getUniqReferenceOf($order.id_order)} Replace this line with: {$order.id_order} Not tested, but shoud work. Link to comment Share on other sites More sharing options...
AlanHogg Posted June 27, 2017 Author Share Posted June 27, 2017 Scully, it does work and we are really grateful for your time and help! Once again many thanks Alan 1 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