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?
I cannot get my head around the actions folders in admin
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Has thanked: 70 times
- Been thanked: 152 times
Re: I cannot get my head around the actions folders in admin
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.
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.
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
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
- burt
- Core Team
- Posts: 4551
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: I cannot get my head around the actions folders in admin
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.
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.
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: I cannot get my head around the actions folders in admin
All the admin files used to have code that looked like 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.
Code: Select all
switch ($_GET['action'] ?? '') {
case 'do_something':
break;
default:
}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.
Code: Select all
if ('act' === $_GET['action']) {