Hamendra Sunthwal Posted August 18, 2020 Share Posted August 18, 2020 foreach($order_to_convert as $odr_id) { $objOrder = new Order($odr_id); $history = new OrderHistory(); $history->id_order = (int)$objOrder->id; //$history->changeIdOrderState((int)$sts_id, (int)($objOrder->id)); //$history->add(true); $history->addWithemail(true); //$history->save(); } I have used above code to update order status & send email to customers but due to performance issue i have removed the code above & used query to perform the same. but i am not able to send email to customers. Is their any way to send customer email when the order status is updated ? Link to comment Share on other sites More sharing options...
Guest Posted August 18, 2020 Share Posted August 18, 2020 (edited) $history->changeIdOrderState(6, (int)($objOrder->id)); change state to 6 The addWithemail function is built into the function changeIdOrderState. I gave a whole example here on the forum. I mean sometime two months ago. Edited August 18, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
Hamendra Sunthwal Posted August 18, 2020 Author Share Posted August 18, 2020 Thanks for the answer why change order status to 6 ? Link to comment Share on other sites More sharing options...
Guest Posted August 18, 2020 Share Posted August 18, 2020 You must enter a status id each time you change status. You have the old state id 2 and you want to change to state id 6 etc .... Link to comment Share on other sites More sharing options...
Hamendra Sunthwal Posted August 18, 2020 Author Share Posted August 18, 2020 //status id $sts_id = 5 foreach($order_to_convert as $odr_id) { $objOrder = new Order($odr_id); $history = new OrderHistory(); $history->id_order = (int)$objOrder->id; $history->changeIdOrderState((int)$sts_id, (int)($objOrder->id)); $history->addWithemail(true); } I wanted to change all order status to status 5. That's why Link to comment Share on other sites More sharing options...
Hamendra Sunthwal Posted August 18, 2020 Author Share Posted August 18, 2020 Status id is static here for all the orders. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now