Hello. I have a component in _admin and i want to run an action whenever the status of an order is updated. What's the best way to do this?
Cron job, plugin... your question ceratinly needs some more explantion.
Jörgen
For this we have plugin, which change
- status
- description
- pay or not
But you can develop another solution - as wrote Jörgen
We have a component that is responsible for sending the order details to our platform.
Right now, the user has access to a table with the orders listed where he can click to send us the order details.
What we want, is to have this process done automatically after the order status change (or after a payment happens).
I would love to not use cron jobs or having to create a plugin inside the component, since this will be installed in multiple stores.
Is there anyway of having a hook for example that calls a function inside our component?
Just use the triggers provided in VM
when an order status changes it triggers plgVmOnUpdateOrderPayment()
have a vmcustom or system plugin with
e.g.
function plgVmOnUpdateOrderPayment ($data,$old_order_status) {
$status = $this->params->get('status', 'C'); // plugin param
if($data->order_status==$status){
// start doing things
}
}
Dont forget about this (I think maybe can be problem):
- the system plugins is loaded before payments plugin
- after trigger payments plugin (order is pay), then I think not loaded your custom system plugin again