I have a script which runs when an order is successfully created on the front end. When orders are generated but Credit Card processing has failed or is denied, the script does not run and the order is still created in the admin. I need to have it run when someone in the admin area changes an order’s status from Failed or Denied to Processed or Shipped. Where would I place the call to my script in order for this to happen.
in addons/my_changes/func.php add a function called fn_my_changes_change_order_status(&$statusTo, &$statusFrom, &$orderInfo).
In addons/my_changes/init.php have a line of:
fn_register_hooks(‘change_order_status’);
When the cart changes order status by calling fn_change_order_status(), the hook will be invoked and you can then look at the order status you are coming from and what you are going to. You will also have access (and ability to modify) any of the order data associated with that order.
That works great. Now I need to have this run on the front side when an orders status is changed from open to processed. Shouldn’t this work already? Does the front side of the cart run the fn_change_order_status function?
Depends on what’s being done. Every status change goes through fn_change_order_status() so it should catch it for almost everything. There is probably some risk with shipping addons or other addons from 3rd parties.
The “front side” would be called after this. if the status change is a result of a customer action (like checkout).