Notify Customer when order status change

Hello, quick question please…
When I have this code:

$order_data = array(
            'status' => $order_status
);
$update_order_status = db_query("UPDATE ?:orders SET ?u WHERE order_id = ?i", $order_data, $order_id);

how could I notify customer AND NOT sales department? just send a notification to customers when I change the order status.

*I am not using CS-Cart API or anything else. Just, queries, is that possible?

Thank you for your time

You can go to Settings → Administrator notifications and turn off E-mail as needed for each case.

Hello, thank you took time to answer. These queries are inside custom addon. If I change the order status this way, does this action send mail to client? I believe not, otherwise sales department would take too! Am I corrent?

You can use event dispatcher in this case. Add proper notification rules will achieve what you need.

What do you mean by that? Could you give me an example? Thanks in advance

Please use built-in functions to change statuses. In this case status notification settings will be used

fn_change_order_status($order_id, $order_status);

Thank you for your time! I knew that func, but I would like to exclude the sales department take mail for that order status changed. Thus, I used this simple query…Any ideas or help for that?

thanks in advance

In this case try

fn_change_order_status($order_id, $order_status, '', fn_get_notification_rules(['notify_department' => true], false));

1 Like

Hello, thanks for the tip! I will give it a try and let you know, Have a nice day

Sincerely,
Grigoriadis Kyriakos