Hello, i am using a custom php script that generates the tracking number for an order and changes the order status to Shipped. How can i also make to send the shipped themplate email like when i manually change the status to shipped for BO.
This is my code
$objOrder = new Order($id_comanda);
$history = new OrderHistory();
$history->id_order = (int)$objOrder->id;
$history->changeIdOrderState(4, (int)($objOrder->id));
$history->id_employee = 3;
$link->query("INSERT INTO ps_order_history (id_employee, id_order, id_order_state, date_add) VALUES ('3', '$id_comanda', '4', NOW());");
Coming back with an edit: I solved my problem by replacing the last line with $history->addWithemail(true);