Jump to content

[] How to Update Order Status with a function or PHP code?


Recommended Posts

Hello, I need a function or a PHP code that updates the order status tu status #2 (Payment Acepted)


I've tried this:


$objOrder = new Order(1); //order with id=1
$history = new OrderHistory();
$history->id_order = (int)$objOrder->id;
$history->changeIdOrderState(2, (int)($objOrder->id)); //order status=2
echo 'done';


But it dont work (It should update order #1 to status 2). It display done.


Prestashop version:


Somebody knows how to do it?


Thanks in advance!

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

  • 4 months later...

Hello friend, I also had this problem and managed to solve this:


So you need to specify two times the new state :

$history = new OrderHistory();
$history->id_order = (int)($id_order);
[b]$history->id_order_state = (int)(4);[/b]
$history->changeIdOrderState((int)(4), $order);


More details see this link: http://forge.prestas...owse/PSCFV-5580


After a look at my shop prestashop modules:




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

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...