Yes fully working and no problems in version 4.0.17
/include/func.php Mod1
Code:
#
# Mail template processing
#
$admin_notify = (($order_status == "Q") || ($order_status == "I" && $config["Email_Note"]["enable_init_order_notif"] == "Y"));
$customer_notify = (($order_status == "Q" || $order_status == "I") && $config["Email_Note"]["enable_init_order_notif_customer"] == "Y");
/include/func.php Mod2
Code:
# mod.extended.order.status, add check for cancel
elseif(($status == "D" && $order["status"] != "D" && $order["status"] != "F")
|| ($status == "X" && $order["status"] != "X" && $order["status"] != "D" && $order["status"] != "F")){
func_decline_order($orderid, $status);
}
# mod.extended.order.status, add check for cancel
elseif(($status == "F" && $order["status"] != "F" && $order["status"] != "D" && $order["status"] != "X")){
func_update_quantity($order_data["products"]);
if($current_area == 'C')
$session_failed_transaction++;
# mod.extended.order.status, email notifications for fail
$userinfo =$order_data["userinfo"];
$to_customer = ($userinfo['language']?$userinfo['language']:$config['default_customer_language']);
$mail_smarty->assign("products", func_translate_products($order_data["products"], $to_customer));
$mail_smarty->assign("order", $order);
$mail_smarty->assign("customer", $userinfo);
// send email notifications to customer
if($config['Email_Note']['eml_oc_notif_failed'] == 'Y'){
func_send_mail($userinfo['email'],"mail/order_customer_failed_subj.tpl", "mail/order_customer_failed.tpl", $config["Company"]["orders_department"], false);
}
// send email notifications to admin
if($config['Email_Note']['eml_oa_notif_failed'] == 'Y'){
$mail_smarty->assign("show_order_details", "Y");
func_send_mail($config["Company"]["orders_department"], "mail/order_admin_failed_subj.tpl", "mail/order_admin_failed.tpl", $config["Company"]["orders_department"], true, true);
$mail_smarty->assign("show_order_details", "");
}
}
/include/func.php Mod3
Code:
elseif ($status == "C" && $order["status"] != "C") {
func_complete_order($orderid);
}
# mod.extended.order.status, check extended status and send email notifications for shipping, backordered, back in stock, process_return, refunded
if($status == "S" || $status == "B" || $status == "K" || $status == "R" || $status == "U" || $status == "T"){
$userinfo =$order_data["userinfo"];
$to_customer = ($userinfo['language']?$userinfo['language']:$config['default_customer_language']);
$mail_smarty->assign("products", func_translate_products($order_data["products"], $to_customer));
$mail_smarty->assign("order", $order);
$mail_smarty->assign("customer", $userinfo);
}
switch($status){
//(S)hipping
case "S":
if ($order["status"] != "S") {
if ($config['Email_Note']['eml_oc_notif_process_shipping'] == 'Y')
func_send_mail($userinfo['email'],"mail/order_customer_process_shipping_subj.tpl", "mail/order_customer_process_shipping.tpl", $config["Company"]["orders_department"], false);
}
break;
//(B)ackordered
case "B":
if ($order["status"] != "B") {
if ($config['Email_Note']['eml_oc_notif_backordered'] == 'Y')
func_send_mail($userinfo['email'],"mail/order_customer_backordered_subj.tpl", "mail/order_customer_backordered.tpl", $config["Company"]["orders_department"], false);
}
break;
//(K) Back in Stock
case "K":
if ($order["status"] != "K") {
if ($config['Email_Note']['eml_oc_notif_back_in_stock'] == 'Y')
func_send_mail($userinfo['email'],"mail/order_customer_back_in_stock_subj.tpl", "mail/order_customer_back_in_stock.tpl", $config["Company"]["orders_department"], false);
}
break;
//(R) Process Return
case "R":
if ($order["status"] != "R") {
if ($config['Email_Note']['eml_oc_notif_process_return'] == 'Y')
func_send_mail($userinfo['email'],"mail/order_customer_process_return_subj.tpl", "mail/order_customer_process_return.tpl", $config["Company"]["orders_department"], false);
}
break;
//(U) Refunded
case "U":
if ($order["status"] != "U") {
if ($config['Email_Note']['eml_oc_notif_refunded'] == 'Y')
func_send_mail($userinfo['email'],"mail/order_customer_refunded_subj.tpl", "mail/order_customer_refunded.tpl", $config["Company"]["orders_department"], false);
}
break;
//(T) Bank Transfer
case "T":
if ($order["status"] != "T") {
if ($config['Email_Note']['eml_oc_notif_bank_transfer1'] == 'Y')
func_send_mail($userinfo['email'],"mail/order_customer_bank_transfer_subj.tpl", "mail/order_customer_bank_transfer.tpl", $config["Company"]["orders_department"], false);
}
break;
default:
break;
}
I also added a email to send to a customer when there payment order was by Bank Transfer, you can of cause delete the bottom bit as it was not in the original code by X-Light.
If you do not want the bank transfer email in the above func.php mod3 then delete:
Code:
//(T) Bank Transfer
case "T":
if ($order["status"] != "T") {
if ($config['Email_Note']['eml_oc_notif_bank_transfer1'] == 'Y')
func_send_mail($userinfo['email'],"mail/order_customer_bank_transfer_subj.tpl", "mail/order_customer_bank_transfer.tpl", $config["Company"]["orders_department"], false);
}
break;
/include/func.php Mod4
Code:
#
# Decrease quantity in stock when "declined" or "failed" order is became "completed", "processed" or "queued"
#
# mod.extended.order.status, added cancelled and shipping to this check
if ($status != $order["status"] && strpos("DFX",$order["status"])!==false && strpos("CPQS",$status)!==false) {
func_update_quantity($order_data["products"],false);
}
}
}
/include/func.php Mod5
Code:
if($config['Email_Note']['eml_order_p_notif_admin'] == 'Y') {
# mod.extended.order.status, changed email template for processed
func_send_mail($config["Company"]["orders_department"], "mail/order_admin_processed_subj.tpl", "mail/order_admin_processed.tpl", $config["Company"]["orders_department"], true, true);
} $mail_smarty->assign("show_order_details", "");
/include/func.php Mod6
Code:
#
# This function performs activities nedded when order is declined
# status may be assign (D)ecline or (F)ail
# (D)ecline order sent mail to customer, (F)ail - not
#
function func_decline_order($orderids, $status = "D") {
global $config, $mail_smarty;
global $sql_tbl, $to_customer;
if(($status != "D") && ($status != "F") && ($status != "X")) return;
if(!is_array($orderids))$orderids = array($orderids);
foreach($orderids as $orderid)
{
/include/func.php Mod7
Code:
# mod.extended.order.status, send email notifications for cancel
else if($status == "X"){
$mail_smarty->assign("customer",$userinfo);
$mail_smarty->assign("products",$products);
$mail_smarty->assign("giftcerts",$giftcerts);
$mail_smarty->assign("order",$order);
$to_customer = func_query_first_cell ("SELECT language FROM $sql_tbl[customers] WHERE login='$userinfo[login]'");
if(empty($to_customer))
$to_customer = $config['default_customer_language'];
$mail_smarty->assign("products", func_translate_products($products, $to_customer));
// send email notification to customer
if($config['Email_Note']['eml_oc_notif_cancelled'] == 'Y') {
func_send_mail($userinfo["email"], "mail/order_customer_cancelled_subj.tpl","mail/order_customer_cancelled.tpl", $config["Company"]["orders_department"], false);
}
// send email notification to admin
if($config['Email_Note']['eml_oc_notif_cancelled'] == 'Y') {
$mail_smarty->assign("show_order_details", "Y");
func_send_mail($config["Company"]["orders_department"], "mail/order_admin_cancelled_subj.tpl", "mail/order_admin_cancelled.tpl", $config["Company"]["orders_department"], true, true);
$mail_smarty->assign("show_order_details", "");
}
}
The above is my working 4.0.17 func.php code for this custom mod.