Jump to content

Change order status from shipping module


Amazzing

Recommended Posts

Hi everyone, 

 

I want to set a special order status from shipping module.

I can actually change the status and it is visible in order history, but for some reason it is immideately updated by default one, so in order status history I see: 
1) my_custom_status 
2) default_status (current_state)

 

I tried to do change order status with this code: 

// tried the following hooks: 
// hookActionValidateOrder
// hookActionOrderStatusUpdate
// hookActionOrderStatusPostUpdate

public function hookActionOrderStatusPostUpdate($params)
{
        ...
        $requires_status_update = true;
        $custom_order_status = 15; 
        if ($params['newOrderStatus']->id ==  $custom_order_status || !$requires_status_update)
            return;
        $history = new OrderHistory();	
	$history->id_order = $params['id_order'];
        $history->changeIdOrderState($custom_order_status, $params['id_order']);
       ...
}
 
also tried to update order status in a different way, using same hooks as above:
$order = new Order($params['id_order']);
$order->setCurrentState($custom_order_status);
 
None of these ways worked. everytime my custom order status is overriden by status set in paymentModule.

So is there a way to change order status from shipping module, using hooks, without modifying payment module? 

Edited by Amazzing (see edit history)
Link to comment
Share on other sites

  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...