Page 1 of 2
Printer-friendly invoice on checkout_success
Posted: Thu Jan 20, 2022 1:12 pm
by Kofod95
If anyone could have use for it, here is a content-module for checkout_success. The module adds a button that opens (in a new tab) a new "Invoice"-page. It's almost an exact replica of the admin one, just made to include front-end styling and check to prevent users from seeing invoices other than their own.
It was written for 1.0.7.12 but tested on 1.0.8.9 as well. This means it uses some old-style code in places.
Feel free to use it, comment on it, change it and whatever you might want!
//Daniel
Re: Printer-friendly invoice on checkout_success
Posted: Thu Jan 20, 2022 2:49 pm
by ReneH4
Thanks Daniel, I am on 1079 but I am going to try! Good add-on!
Re: Printer-friendly invoice on checkout_success
Posted: Thu Jan 20, 2022 3:29 pm
by Kofod95
ReneH4 wrote: ↑Thu Jan 20, 2022 2:49 pm
1079
I think it's fine all the way back to 1.0.4.0 and maybe earlier (1.0.4.0 was when I met PhoenixCart, so I'm unsure on what was modularized when before that), but I haven't tested it, so let me know if you have any trouble!
//Daniel
Re: Printer-friendly invoice on checkout_success
Posted: Thu Jan 20, 2022 3:35 pm
by ReneH4
Daniel,
Looking at the code, a question came up.
Have you not considered appending the downloadable invoice to "account_history_info.php?order_id=xxxx"
This is a page that a customer can return to all the time, but checkout success is just a one-time visit. If the customer closes the page the possibility to download is passed.
Just my thoughts....

Re: Printer-friendly invoice on checkout_success
Posted: Thu Jan 20, 2022 4:01 pm
by 14Steve14
Daniel
Many thanks for this mod. Even with my heavily modified invoice once all the code from the batcher invoice and the language file was transferred across it works very well. Using 1.0.7.10.
Re: Printer-friendly invoice on checkout_success
Posted: Thu Jan 20, 2022 6:09 pm
by heatherbell
ReneH4 wrote: ↑Thu Jan 20, 2022 3:35 pm
Have you not considered appending the downloadable invoice to "account_history_info.php?order_id=xxxx"
This is a page that a customer can return to all the time, but checkout success is just a one-time visit. If the customer closes the page the possibility to download is passed.
Just my thoughts....
Probably the customer would expect to find it on account_history - maybe as a button in an additional column after
View in the table.
Re: Printer-friendly invoice on checkout_success
Posted: Thu Jan 20, 2022 7:04 pm
by ReneH4
That would be the best option indeed. But wouldn't that require a core change?
heatherbell wrote: ↑Thu Jan 20, 2022 6:09 pm
ReneH4 wrote: ↑Thu Jan 20, 2022 3:35 pm
Have you not considered appending the downloadable invoice to "account_history_info.php?order_id=xxxx"
This is a page that a customer can return to all the time, but checkout success is just a one-time visit. If the customer closes the page the possibility to download is passed.
Just my thoughts....
Probably the customer would expect to find it on account_history - maybe as a button in an additional column after
View in the table.
Re: Printer-friendly invoice on checkout_success
Posted: Thu Jan 20, 2022 9:07 pm
by Kofod95
ReneH4 wrote: ↑Thu Jan 20, 2022 3:35 pm
["account_history_info.php?order_id=xxxx"] is a page that a customer can return to all the time, but checkout success is just a one-time visit.
Thank you - you are right.
I put it there (checkout success), as it is the norm in Denmark to be offered an option to print an invoice right after purchasing. At the account-menu there is already something that the core order-received mail calls a "detailed invoice", but that is not to printer-friendly. The page in this addon could be linked to from any place, it just makes sure that the customer is logged in, and that it is one of their own orders they are trying to see.
This means I could easily include buttons that links to the invoice other places, and will look into that!
heatherbell wrote: ↑Thu Jan 20, 2022 6:09 pm
Probably the customer would expect to find it on account_history - maybe as a button in an additional column after
View in the table.
Agreed!
ReneH4 wrote: ↑Thu Jan 20, 2022 7:04 pm
But wouldn't that require a core change?
I'm not too far down the rabbit-hole yet, but I don't think it
requires a core change - Let's see what I can do next time I have an hour or two
@14Steve14 I'm glad it integrated nicely! Let me know if you need more flexibility from this addon
- One thing I have considered, since this is the PRO-forum, is to include the Supporters Code for Invoice comments and Invoice Numbering on this catalog-invoice. Feel free to ask me to do it!
//Daniel
Re: Printer-friendly invoice on checkout_success
Posted: Fri Jan 21, 2022 8:01 am
by heatherbell
ReneH4 wrote: ↑Thu Jan 20, 2022 7:04 pm
That would be the best option indeed. But wouldn't that require a core change?
I don't think so - account_history can be copied, edited and placed in /templates/override/includes/pages/
Re: Printer-friendly invoice on checkout_success
Posted: Fri Jan 21, 2022 9:20 am
by 14Steve14
Kofod95 wrote: ↑Thu Jan 20, 2022 9:07 pm
@14Steve14 I'm glad it integrated nicely! Let me know if you need more flexibility from this addon
//Daniel
Only extra thing I did was to add some text to the order confirmation text pointing to the button. I changed the code in one of the other module language files just to see if it worked and will create a new module later when time allows to add the text to the page properly. I may even modify your button code module to add it and change the button positioning and layout. Its all about finding time to do something.