Something like this will be coming eventually. For the time being, you could add it custom by modifying the squirrelcart/functions/control_panel/add_record_cb.func.php function which gets called after adding a record to any table.
The section starting at line #49 already gets executed when an order status is added:
PHP Code:
// if order status being added
if ($table == 'REL_Orders__Order_Status' && !empty($data['Orders_rn'])) {
// restock items IF Inventory Control is ON and its set to restock when this status is assigned
if ($SC['settings']['Use_Inventory_Control'] && in_array("status:$data[Order_Status_rn]",$SC['settings']['Restock_On'])) restock($data['Orders_rn']);
// send shipment notification if status being set to "Shipped"
if ($data['Order_Status_rn'] == 2) {
// the email_ship_notify() function expects the first parameter to be an array matching the record in the Shipments table
// There is no matching record in this case, so setup a similar array to satisfy the function
$shipment = array(
'Shipped_On' => $data['Record_Date'],
'Order_Number' => get_field_val('Orders','Order_Number',"record_number = '$data[Orders_rn]'")
);
// send shipment notification
if ($SC['settings']['Email_Ship']) email_ship_notify($shipment);
}
}
To send an email to a customer, you would need to call the sc_email() function inside that section:
PHP Code:
<?php sc_email('bob@example.com','Email subject','Email content'); ?>
You would need to query the database for some basic order info so you can get the customer's email address, and the name of the status being added.
There is a little more to it than that, but not much.