Jump to content

How to send email when order status is updated ?


Hamendra Sunthwal

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 ?

Link to comment
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)
Link to comment
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

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