Page 1 of 1
I cannot get my head around the actions folders in admin
Posted: Mon Jul 13, 2026 2:56 pm
by 14Steve14
I struggle seeing what should go into the actions section if something new is created for my store.
As an example I have the code for a search feature in admin which allows the store owner to find what customer purchased a particular product searching by customer name, or product. Its a simple page with a simple search feature.
Its all currently in stats_customer_report_blahblahblah.php at the moment with its own language file.
How do I know what from that file should be in the actions section, if anything?
Re: I cannot get my head around the actions folders in admin
Posted: Mon Jul 13, 2026 4:35 pm
by raiwa
If you have a look for example into the core actions directory for customers.php, you'll see 3 different file types:
In the first level the files which keep the proper action files for doing database stuff when something is inserted, updated or deleted depending on the different $_GET actions.
In the old files these were usually placed at the upper part of the file.
In the infoboxes directory the scripts with the infoboxes content for the different $_GET actions,
In the old files these were usually placed at the end of the file.
And in the views directory the main content shown for the different $_GET actions.
In the old files these were usually placed in the center of the file.
Note that the filename = $_GET['action_name']
To understand it better, you could take an older pre 1.0.8.0 version of customer.php and compare how the different parts are now splitted into the action files.
Re: I cannot get my head around the actions folders in admin
Posted: Mon Jul 13, 2026 6:20 pm
by burt
Take the first two posts from here:
https://phoenixcart.org/forum/viewtopic.php?f=54&t=3371
and paste into your favoured AI, asking it "what do you make of this" or somesuch, you get the drift.
It should then give you a broad level overview of the how and importantly the why, architecture is as it is.
Re: I cannot get my head around the actions folders in admin
Posted: Thu Jul 16, 2026 4:41 am
by ecartz
All the admin files used to have code that looked like
Code: Select all
switch ($_GET['action'] ?? '') {
case 'do_something':
break;
default:
}
The 'do_something' case should go in an action file rather than in a giant switch.
The other two parts are infoboxes, which can be different per action, and views, which are different forms for different actions. Those used to be done by if statements in the code.
So in your new file, look to see if you are conditionally doing things based on the selected action. If you are, move those parts into the actions section.