For instance
includes/actions/add_product.php
includes/actions/update_product.php
includes/actions/notify.php
etc
What is the best way to capture catalog actions in a hook?
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: What is the best way to capture catalog actions in a hook?
https://github.com/CE-PhoenixCart/Phoen ... .sql#L1213
That's the hook that parses the actions and invokes the appropriate handler.
If you want to add a new action, you can just add a file to includes/actions, using the same format as the existing ones.
If you want to modify the behavior of an action, you can create a system hook that runs before that one (they're sorted by name, so something that sorts earlier than _23_parse_actions like _23_my_action_handling). If you want to block the core handling, unset($_GET['action'])
That's the hook that parses the actions and invokes the appropriate handler.
If you want to add a new action, you can just add a file to includes/actions, using the same format as the existing ones.
If you want to modify the behavior of an action, you can create a system hook that runs before that one (they're sorted by name, so something that sorts earlier than _23_parse_actions like _23_my_action_handling). If you want to block the core handling, unset($_GET['action'])
-
frankl
- Builder
- Posts: 159
- Joined: Tue Feb 23, 2021 8:39 pm
- Phoenix Version: v1.1.0.4
- Has thanked: 17 times
- Been thanked: 25 times
Re: What is the best way to capture catalog actions in a hook?
Thank you that's great Matt, and it works.
I gather there is no post action hook? I'm setting $_SESSION['cart_changed'] then on the next page load running another hook that looks for the session variable, does it's thing, then unloads the session variable.
I gather there is no post action hook? I'm setting $_SESSION['cart_changed'] then on the next page load running another hook that looks for the session variable, does it's thing, then unloads the session variable.
Check out my addons - app.php/addons/author/frankl/contributions