How to do this in Phoenix?

Talk about Hooks. Share Hooks you have made.
User avatar
Mort_Lemur
Builder
Posts: 64
Joined: Tue Jun 02, 2026 6:12 pm
Phoenix Version: v1.1.0.6
Has thanked: 42 times
Been thanked: 17 times

How to do this in Phoenix?

Post by Mort_Lemur »

Finding my way round Phoenix on an XAMMP set up running php 8.2.

Currently I am modifying the way the invoice looks - as I don't like the stock version (sorry!)
I have produced a new admin/invoice.php file which gives the look i need however, this strays from the way I understand Phoenix works ie it bypasses the Bootstrap system, it injects in-line CSS and is not modular.

Now I know that this probably breaks everything that Phoenix is about (ie no core code changes) but is there another way to achieve this? I guess the invoice.php file will be overwritten with future Phoenix updates?

Maybe call it something like legacy_invoice.php and adjust the calls to this new file?

Let me know if you would like to see the file

Many Thanks :)


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: How to do this in Phoenix?

Post by burt »

Here's what I'd do;

your_admin/invoice.php <--- leave it be
all buttons that lead to this file, leave them be

your_admin/invoiceNEW.php <--- obv name it as you like

Make a new Hook, which listens at the top of admin/invoice.php
This Hook simply performs a redirect to invoiceNEW.php

So, you click a button to your_admin/invoice.php?orders_id=1234
Hook grabs that, and insta redirects you to invoiceNEW.php?orders_id=1234

--

Hooks were explored hardly at all in osCommerce, but they are that old.They do exist in 2.3.4

Phoenix supercharged Hooks as they are a way to extend/change Core Code...without touching Core Code.
You can do all sorts of interesting and cool things with them.

--

In other words...all the Core Stuff is as-is
You have a new Invoice.
Your new hook redirects.

Your new invoice page and your new Hook are highly unlikely to get overwritten by Core Code.
I am not here to build for you.
I am here to build with you. Let's help each other.
User avatar
bonbec
Contributor
Posts: 190
Joined: Mon Oct 26, 2020 12:23 pm
Phoenix Version: V1.1.0.7
Has thanked: 54 times
Been thanked: 40 times

Re: How to do this in Phoenix?

Post by bonbec »

Hello,
I don't like the stock version too (sorry too!) :-)
For my website, for the admin side, I rename the file with the name of my company? In that case, it's become invoice_ara.php. Like this, I know that this file is optimized for my use and it can't be overwritten.
I'd like to see a screenshot of your changes.
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: How to do this in Phoenix?

Post by burt »

And..no need to say sorry guys :+1: 8-) :+1:
I also don't like the Invoice, but yeah, it's functional for the most part.
I am not here to build for you.
I am here to build with you. Let's help each other.
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: How to do this in Phoenix?

Post by raiwa »

Example of a sitewide hook for your case:
placed and named:
includes/hooks/admin/siteWide/redirectInvoice.php

Code: Select all

class hook_admin_siteWide_redirectInvoice {

  function listen_siteWideStart() {
    if (Request::get_page() == 'invoice.php') {
      Href::redirect(Guarantor::ensure_global('Admin')->link('invoice_ara.php')->retain_query_except());
    }
  }

}
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
User avatar
Mort_Lemur
Builder
Posts: 64
Joined: Tue Jun 02, 2026 6:12 pm
Phoenix Version: v1.1.0.6
Has thanked: 42 times
Been thanked: 17 times

Re: How to do this in Phoenix?

Post by Mort_Lemur »

bonbec wrote: Fri Jun 12, 2026 1:03 pm Hello,
I don't like the stock version too (sorry too!) :-)
For my website, for the admin side, I rename the file with the name of my company? In that case, it's become invoice_ara.php. Like this, I know that this file is optimized for my use and it can't be overwritten.
I'd like to see a screenshot of your changes.
Screenshots below. Screenshot 1 is the default, however if you then click on the store name on the invoice it adds the order comments at the bottom, as per screenshot 2.
You do not have the required permissions to view the files attached to this post.
User avatar
Mort_Lemur
Builder
Posts: 64
Joined: Tue Jun 02, 2026 6:12 pm
Phoenix Version: v1.1.0.6
Has thanked: 42 times
Been thanked: 17 times

Re: How to do this in Phoenix?

Post by Mort_Lemur »

Sorry for some reason the screenshot has also copied the admin header - the invoice isnt like that
User avatar
bonbec
Contributor
Posts: 190
Joined: Mon Oct 26, 2020 12:23 pm
Phoenix Version: V1.1.0.7
Has thanked: 54 times
Been thanked: 40 times

Re: How to do this in Phoenix?

Post by bonbec »

Thank you very much @Mort_Lemur
I will post too a screenshot of my redesigned invoice as soon as it is finalized.
User avatar
Mort_Lemur
Builder
Posts: 64
Joined: Tue Jun 02, 2026 6:12 pm
Phoenix Version: v1.1.0.6
Has thanked: 42 times
Been thanked: 17 times

Re: How to do this in Phoenix?

Post by Mort_Lemur »

raiwa wrote: Fri Jun 12, 2026 1:06 pm Example of a sitewide hook for your case:
placed and named:
includes/hooks/admin/siteWide/redirectInvoice.php

Code: Select all

class hook_admin_siteWide_redirectInvoice {

  function listen_siteWideStart() {
    if (Request::get_page() == 'invoice.php') {
      Href::redirect(Guarantor::ensure_global('Admin')->link('invoice_ara.php')->retain_query_except());
    }
  }

}
Thanks for that hook code, however when i rename my invoice invoice_fancy.php and edit the hook code to match it seems to only render the top half of the invoice to just below the address boxes?

Yet when the file is named invoice.php and the hook is deleted, the whole invoice shows.
User avatar
bonbec
Contributor
Posts: 190
Joined: Mon Oct 26, 2020 12:23 pm
Phoenix Version: V1.1.0.7
Has thanked: 54 times
Been thanked: 40 times

Re: How to do this in Phoenix?

Post by bonbec »

@Mort_Lemur you have to duplicate admin/includes/languages/YOUR_LANGUAGE/invoice.php
and change the name of invoice.php to invoice_fancy.php


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