Page 1 of 1

What is the best way to capture catalog actions in a hook?

Posted: Sun Feb 16, 2025 10:27 pm
by frankl
For instance

includes/actions/add_product.php
includes/actions/update_product.php
includes/actions/notify.php

etc

Re: What is the best way to capture catalog actions in a hook?

Posted: Mon Feb 17, 2025 5:32 am
by ecartz
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'])

Re: What is the best way to capture catalog actions in a hook?

Posted: Wed Feb 19, 2025 4:03 am
by frankl
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.

Re: What is the best way to capture catalog actions in a hook?

Posted: Wed Feb 19, 2025 5:29 am
by ecartz
Not anything that runs after the action is processed but before the redirect.