Prestashop: change order status in hookActionOrderStatusUpdate

I create a module that, after the "Accepted payment" state, executes its own process, and if everything is in order, changes the order state to sent. I use hookActionOrderStatusUpdate for this:

public function hookActionOrderStatusUpdate($params)
{
  if($params['newOrderStatus']->id == 2)
        {
           if(!$this->doSomething())
              return false;            
        }
    return /*function for changing order state*/;
}

      

But the problem is that the new order status changes to "Payment accepted". Example:

  • Waiting for payment at the bank rate.
  • Supply
  • Payments accepted

Does anyone know how to move this issue? PS tried hookActionOrderStatusPostUpdate. PS 1.6.0.9

+3


source to share


2 answers


Try displayOrderConfirmation and displayPaymentReturn . These hooks receive the order details in the param variable after payment.



+1


source


I had a similar problem and used a combination of hookActionOrderStatusUpdate

and hookActionOrderHistoryAddAfter

.

The reason for this is that it hookActionOrderHistoryAddAfter

can actually add another status after the "paid" status. And hookActionOrderStatusUpdate

adds it before shipping, but hookActionOrderHistoryAddAfter

doesn't know about the state to be set. So it looks like this:



class MikolaHooks extends Module
{

    public $newOrderStatusId = NULL;
    public function hookActionOrderStatusUpdate($params) {
       $this->newOrderStatusId = $params['newOrderStatus']->id;
    }

    public function hookActionOrderHistoryAddAfter($params) ....

      

0


source







All Articles