Jump to content

Postupdateorderstatus After Status Changed ?


cedricfontaine

Recommended Posts

I'm trying to send order to shipwire when order status has been changed (payment is accepted for example).

 

So I create a hook

 

public function hookpostUpdateOrderStatus($params) {
if ($params['newOrderStatus']->logable) {

My problem is that if I wish to update order status at the end of my hook to a custom status (transmitted to Shipwire) it is added to my order after Payment accepted, so it's not the current status.

I thought that postUpdateOrderStatus would be called after status has been changed ?

Link to comment
Share on other sites

Hi Cedric,

 

The hook postUpdateOrderStatus is called after status has been changed.

I'm not sure what you're trying to do. When you say you created a hook, you meant you register your module on a hook, right ? You want to send your order to shipwire when the status is payment accepted.

 

Did you try something like this ?

 


public function hookpostUpdateOrderStatus($params)
{
 if ($params['newOrderStatus']->id == Configuration::get('PS_OS_PAYMENT'))
 {
   // Send order to shipwire
 }
}

Link to comment
Share on other sites

Yes, that's exactly what I did, but I also want to change the status to the state Preparation in progress.

 

Problem is that if in my hook hookpostUpdateOrderStatus, I change the status of the order, at the very end, I have the wrong order :

01/5/2012 15:30:41

2.gif Payment accepted 01/5/2012 15:30:40 Preparation in progress

 

 

Why the new status is in the wrong position ?

Link to comment
Share on other sites

  • 1 year 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...