Jump to content

How to send email when order status is updated ?


Hamendra Sunthwal
 Share

Recommended Posts

  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 ?

Share this post


Link to post
Share on other sites

$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 by Guest (see edit history)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More