I'am developing module, which after „Payment Accepted“ state executs it's own process and if everything ok - changes order state to Shipped. For that I'am using hookActionOrderStatusUpdate:
public function hookActionOrderStatusUpdate($params)
{
if($params['newOrderStatus']->id == 2)
{
if(!$this->doSomething())
return false;
}
return /*function for changing order's state*/;
}
But problem is, that new order status changes before „Payment Accepted“. Example:
Does anyone know how to reslove that problem? P. S. tried hookActionOrderStatusPostUpdate. PS 1.6.0.9
I had similar problem and I used combination of hookActionOrderStatusUpdate
and hookActionOrderHistoryAddAfter
.
Reason for that is that hookActionOrderHistoryAddAfter
really can add another status after "paid" status. And hookActionOrderStatusUpdate
adds its before "shipped", but hookActionOrderHistoryAddAfter
does not know about status which going to be set.
So it does looks like this:
class MikolaHooks extends Module
{
public $newOrderStatusId = NULL;
public function hookActionOrderStatusUpdate($params) {
$this->newOrderStatusId = $params['newOrderStatus']->id;
}
public function hookActionOrderHistoryAddAfter($params) ....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With