Printer-friendly invoice on checkout_success

Open to all! Ask other shopowners for help.
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Printer-friendly invoice on checkout_success

Post 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
You do not have the required permissions to view the files attached to this post.
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide

Tags:


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
ReneH4
Contributor
Posts: 145
Joined: Mon Oct 26, 2020 12:00 pm
Phoenix Version:
Has thanked: 13 times
Been thanked: 17 times

Re: Printer-friendly invoice on checkout_success

Post by ReneH4 »

Thanks Daniel, I am on 1079 but I am going to try! Good add-on!
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Printer-friendly invoice on checkout_success

Post 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
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
User avatar
ReneH4
Contributor
Posts: 145
Joined: Mon Oct 26, 2020 12:00 pm
Phoenix Version:
Has thanked: 13 times
Been thanked: 17 times

Re: Printer-friendly invoice on checkout_success

Post 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.... ;-)
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Printer-friendly invoice on checkout_success

Post 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.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Printer-friendly invoice on checkout_success

Post 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.
User avatar
ReneH4
Contributor
Posts: 145
Joined: Mon Oct 26, 2020 12:00 pm
Phoenix Version:
Has thanked: 13 times
Been thanked: 17 times

Re: Printer-friendly invoice on checkout_success

Post 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.
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Printer-friendly invoice on checkout_success

Post 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
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Printer-friendly invoice on checkout_success

Post 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/
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Printer-friendly invoice on checkout_success

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


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply