X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   extended order status with email notifications (https://forum.x-cart.com/showthread.php?t=13337)

x-light 04-10-2005 02:15 PM

extended order status with email notifications
 
Hi all,

I have seen requests and solutions for bits and pieces of various order status along with email notifications all over the forum. I was also in need of this so I added more order status along with email notifications which can be enabled or disabled from email notificaitons menu in general settings from admin. This was modified for Version 4.0.13, but I imagine it should work with 4.xx unless there was some major changes to include/func.php 4.xx versions.

The functions are complete but the body of each email template is quite generic, just showing the order id, date and invoice. It would be nice to customize each template for each status to make it more meaniful for the customers. I don't have time to do this right now, however, if you already have something like this for various statuses shown below, I am sure everyone would appreciate it if you share your template code.

I am posting this mod in hope that everyone could benefit from this. It would be great if others can post additions to this mod of other status I haven't thought about or detailed HTML email templates for some of these status. Enjoy. :)

~x-light
---------- readme.txt ----------
Description: This mod adds additional order status along with email notifications to either customer and/or administrators. These notifications can also be enabled or disabled via the email notifications.

Key feature:
* added the following status
- cancelled, process shipping, back in stock, process return, refunded, fraud
* the cancel status has the same logic as declined or failed, that is quantities are automatically updated and/or coupons, giftcerts are rolled back
* the shipping has the same logic as queued, processed, or complete
* moved existing email options related with order under Order Notifications Options starting at orderby number 2000
(check update_tables.sql for details)

To Do:
* modify the body of the email templates to make each status message more meaniful to customers and administrators
* add body of the email templates for plain text (not really needed right now)

Modified for X-Cart Gold: Version 4.0.13 stock

Tested with: Version 4.0.13 stock
Apache 1.33, OpenSSL 0.9.6b, PHP 4.3.10, SQL 4.0.22

Intended Audience: This mod requires changes to various php, tpl files and some
sql table(s) as well as outlined in "General Overview" below. If you are a
store owner and have met the requirements for the modified and tested X-Cart
versions, you can follow the instructions below and it should work. However, if
you intend to make this mod work with previous X-Cart versions or make any
changes to this mod, it is recommended that you hire a developer with
development and coding knowledge to perform this task.

Disclaimer: This mod may work on other X-Cart versions, but it has not been
tested. Therefore, use it at your own risk. We are not responsible for any loss
in sales, time spent or damages that is direct or indirectly caused by this
modification to your store. By using this modification, you have agreed all the
terms to the license agreement and hold all personel indemfiable and harmless
including but not limited to owners, shareholders, stakeholders, employees,
contractors, or anyone else related to the business.

License: Standard Open Source / Freeware

As usual, always backup your current store or try it on a development store
before integrating this with production.

General Overview:

sql table modification
xcart_config
files modified application logic related:
include/func.php
template related:
skin1\main\order\order_status.tpl
various tpl files in skin1\mail
various tpl files in skin1\mail\html
language files:
lang.txt.csv (comma delimited)

each code section which has been modified has the comment header:
mod.extended.order.status

Instructions:

Prerequisites:
BACKUP, BACKUP, BACKUP!!

Installation:

1. update sql table using ssh or sql patch from admin menu
If using ssh, issue command:
"mysql -u username -p dbname < update_tables.sql"
If using sql patch just upload the update_tables.sql file

2. modify code
a. match the code section under the "find original code snippet" and "end original code snippet" with your source
b. replace original code section with the code section under the "replace modified code snippet"

3. repeat step 2 for each php and template files until all are done

4. import the language file used in this modifications "lang.txt.csv" under language settings in admin
---------- update_tables.sql ----------
Code:

# this script will update the 'orderby' field for all order status and
# add new email notifications status records for new email notifications

# table(s) affected
# xcart_config

# field(s) affected
# orderby

# update 'orderby' first
UPDATE xcart_config SET orderby = '2010' where name = 'enable_init_order_notif_customer';
UPDATE xcart_config SET orderby = '2011' where name = 'enable_init_order_notif';
UPDATE xcart_config SET orderby = '2012' where name = 'send_notifications_to_provider';
UPDATE xcart_config SET orderby = '2015' where name = 'eml_order_p_notif_customer';
UPDATE xcart_config SET orderby = '2016' where name = 'eml_order_p_notif_admin';
UPDATE xcart_config SET orderby = '2017' where name = 'eml_order_p_notif_provider';
UPDATE xcart_config SET orderby = '2025' where name = 'eml_order_c_notif_customer';
UPDATE xcart_config SET orderby = '2035' where name = 'eml_order_d_notif_customer';

# new records
INSERT INTO xcart_config (name,comment,value,category,orderby,type,defvalue) VALUES ('eml_order_notif_header',':__________Order Notification Options__________','N','Email_Note',2000,'','N');
INSERT INTO xcart_config (name,comment,value,category,orderby,type,defvalue) VALUES ('eml_oc_notif_process_shipping','\'Order in process shipping\' notification to customer','Y','Email_Note',2020,'checkbox','Y');
INSERT INTO xcart_config (name,comment,value,category,orderby,type,defvalue) VALUES ('eml_oc_notif_backordered','\'Order is backordered\' notification to customer','Y','Email_Note',2030,'checkbox','Y');
INSERT INTO xcart_config (name,comment,value,category,orderby,type,defvalue) VALUES ('eml_oc_notif_back_in_stock','\'Order is back in stock\' notification to customer','Y','Email_Note',2040,'checkbox','Y');
INSERT INTO xcart_config (name,comment,value,category,orderby,type,defvalue) VALUES ('eml_oc_notif_failed','\'Order has failed\' notification to customer','Y','Email_Note',2045,'checkbox','Y');
INSERT INTO xcart_config (name,comment,value,category,orderby,type,defvalue) VALUES ('eml_oa_notif_failed','\'Order has failed\' notification to orders department','Y','Email_Note',2046,'checkbox','Y');
INSERT INTO xcart_config (name,comment,value,category,orderby,type,defvalue) VALUES ('eml_oc_notif_cancelled','\'Order is cancelled\' notification to customer','Y','Email_Note',2050,'checkbox','Y');
INSERT INTO xcart_config (name,comment,value,category,orderby,type,defvalue) VALUES ('eml_oa_notif_cancelled','\'Order is cancelled\' notification to orders department','Y','Email_Note',2051,'checkbox','Y');
INSERT INTO xcart_config (name,comment,value,category,orderby,type,defvalue) VALUES ('eml_oc_notif_process_return','\'Order is being processed for return\' notification to customer','Y','Email_Note',2055,'checkbox','Y');
INSERT INTO xcart_config (name,comment,value,category,orderby,type,defvalue) VALUES ('eml_oc_notif_refunded','\'Order return accepted\' notification to customer','Y','Email_Note',2060,'checkbox','Y');

---------- lng.txt.csv ----------
Code:

"txt_thankyou_for","Thank-You for","Thank-You for","Text"
"txt_tracking","Tracking","Tracking","Text"
"txt_oa_processed","Processed","Processed","Text"
"txt_oc_process_shipping","is scheduled for shipping","is scheduled for shipping","Text"
"txt_oc_complete","has shipped!","has shipped!","Text"
"txt_oc_backordered","item(s) out of stock","item(s) out of stock","Text"
"txt_oc_back_in_stock","item(s) now in stock!","item(s) now in stock!","Text"
"txt_oc_cancelled","has been cancelled","has been cancelled","Text"
"txt_oa_cancelled","Cancelled","Cancelled","Text"
"txt_oc_failed","unable to process","unable to process","Text"
"txt_oa_failed","Failed","Failed","Text"
"txt_oc_process_return","your return is being processed","your return is being processed","Text"
"txt_oc_refunded","your return has been accepted","your return has been accepted","Text"
"lbl_shipping","Shipping","Shipping","Labels"
"lbl_back_in_stock","Back In Stock","Back In Stock","Labels"
"lbl_cancelled","Cancelled","Cancelled","Labels"
"lbl_process_return","Process Return","Process Return","Labels"
"lbl_refunded","Refunded","Refunded","Labels"
"lbl_fraud","Fraud","Fraud","Labels"

---------- main/order_status.tpl
Code:

{* $Id: order_status.tpl,v 1.4 2004/05/28 12:21:03 max Exp $ *}
{if $extended eq "" and $status eq ""}
{$lng.lbl_wrong_status}
{else}
{if $mode eq "select"}
<SELECT name="{$name}" {$extra}>
{if $extended ne ""}<OPTION value=""></OPTION>{/if}
<OPTION value="I" {if $status eq "I"}selected{/if}>{$lng.lbl_not_finished}</OPTION>
<OPTION value="Q" {if $status eq "Q"}selected{/if}>{$lng.lbl_queued}</OPTION>
<OPTION value="P" {if $status eq "P"}selected{/if}>{$lng.lbl_processed}</OPTION>
{* mod.extended.order.status *}
<OPTION value="S" {if $status eq "S"}selected{/if}>{$lng.lbl_shipping}</OPTION>
<OPTION value="C" {if $status eq "C"}selected{/if}>{$lng.lbl_complete}</OPTION>
<OPTION value="B" {if $status eq "B"}selected{/if}>{$lng.lbl_backordered}</OPTION>
<OPTION value="K" {if $status eq "K"}selected{/if}>{$lng.lbl_back_in_stock}</OPTION>
<OPTION value="D" {if $status eq "D"}selected{/if}>{$lng.lbl_declined}</OPTION>
<OPTION value="F" {if $status eq "F"}selected{/if}>{$lng.lbl_failed}</OPTION>
{* mod.extended.order.status *}
<OPTION value="X" {if $status eq "X"}selected{/if}>{$lng.lbl_cancelled}</OPTION>
<OPTION value="R" {if $status eq "R"}selected{/if}>{$lng.lbl_process_return}</OPTION>
<OPTION value="U" {if $status eq "U"}selected{/if}>{$lng.lbl_refunded}</OPTION>
<OPTION value="Z" {if $status eq "Z"}selected{/if}>{$lng.lbl_fraud}</OPTION>
</SELECT>
{elseif $mode eq "static"}
{* mod.extended.order.status *}
{if $status eq "I"}{$lng.lbl_not_finished}{elseif $status eq "Q"}{$lng.lbl_queued}{elseif $status eq "P"}{$lng.lbl_processed}{elseif $status eq "S"}{$lng.lbl_shipping}{elseif $status eq "C"}{$lng.lbl_complete}{elseif $status eq "B"}{$lng.lbl_backordered}{elseif $status eq "K"}{$lng.lbl_back_in_stock}{elseif $status eq "D"}{$lng.lbl_declined}{elseif $status eq "F"}{$lng.lbl_failed}{elseif $status eq "X"}{$lng.lbl_cancelled}{elseif $status eq "R"}{$lng.lbl_process_return}{elseif $status eq "U"}{$lng.lbl_refunded}{elseif $status eq "Z"}{$lng.lbl_fraud}{/if}
{*{if $status eq "I"}{$lng.lbl_not_finished}{elseif $status eq "Q"}{$lng.lbl_queued}{elseif $status eq "P"}{$lng.lbl_processed}{elseif $status eq "D"}{$lng.lbl_declined}{elseif $status eq "B"}{$lng.lbl_backordered}{elseif $status eq "F"}{$lng.lbl_failed}{elseif $status eq "C"}{$lng.lbl_complete}{/if}*}
{/if}
{/if}

---------- include/func.php ----------
Code:

---------- mod1
// find original code snippet in "function func_place_order..."
#
# 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"));
// end original code snippet

// replace modified code snippet
#
# Mail template processing
#

                $admin_notify = (($order_status == "Q") || ($order_status == "I" && $config["Email_Note"]["enable_init_order_notif"] == "Y"));
# mod.extended.order.status, force to check send email on initial order for customer
                $customer_notify = (($order_status == "Q" || $order_status == "I") && $config["Email_Note"]["enable_init_order_notif_customer"] == "Y");
// end modified code snippet

---------- mod 2
// find original code snippet in "function func_change_order_status..."
                elseif($status == "D" && $order["status"] != "D" && $order["status"] != "F") {
                        func_decline_order($orderid, $status);
                }
                elseif($status == "F" && $order["status"] != "F" && $order["status"] != "D") {
                        func_update_quantity($order_data["products"]);
                        if($current_area == 'C')
                                $session_failed_transaction++;
                }
// end original code snippet

// replace modified code snippet
# 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", "");
                    }
                }
// end modified code snippet

---------- mod 3
// find original code snippet in "function func_change_order_status..."
                elseif ($status == "C" && $order["status"] != "C") {
                        func_complete_order($orderid);
                }
// end original code snippet

// replace modified code snippet
                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"){
            $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;
            default:
                break;
        } // switch
// end modified code snippet

---------- mod 4
// find original code snippet in "function func_change_order_status..."
                #
                # Decrease quantity in stock when "declined" or "failed" order is became "completed", "processed" or "queued"
                #
                if ($status != $order["status"] && strpos("DF",$order["status"])!==false && strpos("CPQ",$status)!==false) {
                        func_update_quantity($order_data["products"],false);
                }
// end original code snippet

// replace modified code snippet
                #
                # 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);
                }
// end modified code snippet

---------- mod 5
// find original code snippet in "function func_process_order..."
                if($config['Email_Note']['eml_order_p_notif_admin'] == 'Y') {
                        func_send_mail($config["Company"]["orders_department"], "mail/order_notification_subj.tpl", "mail/order_notification_admin.tpl", $config["Company"]["orders_department"], true, true);
                }
// end original code snippet

// replace modified code snippet
                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);
                }
// end modified code snippet

---------- mod 6
// find original code snippet in "function func_decline_order..."
                if(($status != "D") && ($status != "F")) return;
// end original code snippet

// replace modified code snippet
# mod.extended.order.status, permit cancel
                if(($status != "D") && ($status != "F") && ($status != "X")) return;
// end modified code snippet

---------- mod 7
// find original code snippet in "function func_decline_order..."
        if($status == "D")
          {
        $mail_smarty->assign("customer",$userinfo);
        $mail_smarty->assign("products",$products);
        $mail_smarty->assign("giftcerts",$giftcerts);
        $mail_smarty->assign("order",$order);

                if($config['Email_Note']['eml_order_d_notif_customer'] == 'Y') {
                        $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));
                        func_send_mail($userinfo["email"], "mail/decline_notification_subj.tpl","mail/decline_notification.tpl", $config["Company"]["orders_department"], false);
                }
        }
// end original code snippet

// replace modified code snippet
        if($status == "D")
          {
        $mail_smarty->assign("customer",$userinfo);
        $mail_smarty->assign("products",$products);
        $mail_smarty->assign("giftcerts",$giftcerts);
        $mail_smarty->assign("order",$order);

                if($config['Email_Note']['eml_order_d_notif_customer'] == 'Y') {
                        $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));
                        func_send_mail($userinfo["email"], "mail/decline_notification_subj.tpl","mail/decline_notification.tpl", $config["Company"]["orders_department"], false);
                }
        }
# 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", "");
        }
    }
// end modified code snippet


---------- ALL EMAIL SUBJECT TEMPLATES (skin1/mail) ----------
---------- decline_notification_subj.tpl ----------
Code:

{* mod.extended.order.status *}
{config_load file="$skin_config"}{$lng.lbl_your_order} #{$order.orderid} {$lng.eml_sbj_order_declined}
{*{config_load file="$skin_config"}{$config.Company.company_name}: {$lng.lbl_your_order} #{$order.orderid} {$lng.eml_sbj_order_declined}*}

---------- order_admin_cancelled_subj.tpl ---------
Code:

{* mod.extended.order.status templates *}
{config_load file="$skin_config"}{ $config.Company.company_name }: {$lng.lbl_order_receipt} #{$order.orderid} - {$lng.txt_oa_cancelled}

---------- order_admin_failed_subj.tpl ---------
Code:

{* mod.extended.order.status templates *}
{config_load file="$skin_config"}{ $config.Company.company_name }: {$lng.lbl_order} #{$order.orderid} - {$lng.txt_oa_failed}

---------- order_admin_processed_subj.tpl ----------
Code:

{* mod.extended.order.status templates *}
{config_load file="$skin_config"}{ $config.Company.company_name }: {$lng.lbl_order} #{$order.orderid} - {$lng.txt_oa_processed}

---------- order_cust_complete_subj.tpl ----------
Code:

{* mod.extended.order.status *}
{config_load file="$skin_config"}{$lng.lbl_your_order} #{$order.orderid} {$lng.txt_oc_complete}{if $order.tracking} {$lng.txt_tracking} #{$order.tracking}{/if}
{*{config_load file="$skin_config"}{ $config.Company.company_name }: {$lng.lbl_your_order} #{$order.orderid} {$lng.txt_has_been_complete}*}

---------- order_cust_processed_subj.tpl ----------
Code:

{* mod.extended.order.status *}
{config_load file="$skin_config"}{$lng.lbl_your_order} #{$order.orderid} {$lng.txt_has_been_processed}
{*{config_load file="$skin_config"}{ $config.Company.company_name }: {$lng.lbl_your_order} #{$order.orderid} {$lng.txt_has_been_processed}*}

---------- order_customer_back_in_stock_subj.tpl ----------
Code:

{* mod.extended.order.status templates *}
{config_load file="$skin_config"}{$lng.lbl_your_order} #{$order.orderid}, {$lng.txt_oc_back_in_stock}

---------- order_customer_backordered_subj.tpl ----------
Code:

{* mod.extended.order.status templates *}
{config_load file="$skin_config"}{$lng.lbl_your_order} #{$order.orderid}, {$lng.txt_oc_backordered}

---------- order_customer_cancelled_subj.tpl ----------
Code:

{* mod.extended.order.status templates *}
{config_load file="$skin_config"}{$lng.lbl_your_order} #{$order.orderid} {$lng.txt_oc_cancelled}

---------- order_customer_failed_subj.tpl ----------
Code:

{* mod.extended.order.status templates *}
{config_load file="$skin_config"}{$lng.lbl_your_order} #{$order.orderid}, {$lng.txt_oc_failed}

---------- order_customer_process_return_subj.tpl ----------
Code:

{* mod.extended.order.status templates *}
{config_load file="$skin_config"}{$lng.lbl_your_order} #{$order.orderid}, {$lng.txt_oc_process_return}

---------- order_customer_process_shipping_subj.tpl ----------
Code:

{* mod.extended.order.status templates *}
{config_load file="$skin_config"}{$lng.lbl_your_order} #{$order.orderid} {$lng.txt_oc_process_shipping}

---------- order_customer_refunded_subj.tpl ----------
Code:

{* mod.extended.order.status templates *}
{config_load file="$skin_config"}{$lng.lbl_your_order} #{$order.orderid}, {$lng.txt_oc_refunded}

---------- order_customer_subj.tpl ----------
Code:

{* mod.extended.order.status *}
{config_load file="$skin_config"}{$lng.txt_thankyou_for} {$lng.lbl_your_order|lower} #{$order.orderid}
{*{config_load file="$skin_config"}{ $config.Company.company_name }: {$lng.lbl_order_receipt} #{$order.orderid}*}


---------- ALL HTML EMAIL BODY TEMPLATES (skin1/mail/html) ----------
Warning, some of these templates are hard coded in US language and rather incomplete. Please check them before using them in your real store!
---------- order_admin_cancelled.tpl ----------
Code:

{* mod.extended.order.status templates - order_admin_cancelled.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}

{assign var=where value="A"}



{$lng.eml_this_is_order} #{$order.orderid} - order cancelled



Order has been cancelled either by admin or customer

<HR size="1" noshade>



<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>

<TR>
        <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>

{include file="mail/html/order_invoice.tpl" to_admin="Y"}

{include file="mail/html/signature.tpl"}

---------- order_admin_failed.tpl ----------
Code:

{* mod.extended.order.status templates - order_admin_failed.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}

{assign var=where value="A"}



{$lng.eml_this_is_order} #{$order.orderid} - order failed



Customer order failed for the following reasons:


[*]list reason 1[*]list reason 2

{include file="mail/html/order_invoice.tpl" to_admin="Y"}

{include file="mail/html/signature.tpl"}

---------- order_admin_processed.tpl ----------
Code:

{* mod.extended.order.status templates - order_admin_processed.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}

{assign var=where value="A"}



{$lng.eml_this_is_order} #{$order.orderid} - order has been processed

{include file="mail/html/order_invoice.tpl" to_admin="Y"}

{include file="mail/html/signature.tpl"}

---------- order_customer_back_in_stock.tpl ----------
Code:

{* mod.extended.order.status templates - order_customer_back_in_stock.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/09/05 *}


{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}



{$lng.lbl_dear} {$customer.title} {$customer.firstname} {$customer.lastname},



items now back in stock, you can continue with this order or cancel


<HR size="1" noshade>



<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>
{if $order.tracking}
<TR>
<TD>{$lng.lbl_tracking_number}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.tracking}</TT></TD>
</TR>
{/if}
<TR>
        <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/order_invoice.tpl"}

{include file="mail/html/signature.tpl"}

---------- order_customer_backordered.tpl ----------
Code:

{* mod.extended.order.status templates - order_customer_backordered.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}



{$lng.lbl_dear} {$customer.title} {$customer.firstname} {$customer.lastname},



order has been backordered


<HR size="1" noshade>



<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>
{if $order.tracking}
<TR>
<TD>{$lng.lbl_tracking_number}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.tracking}</TT></TD>
</TR>
{/if}
<TR>
        <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/order_invoice.tpl"}

{include file="mail/html/signature.tpl"}

---------- order_customer_cancelled.tpl ----------
Code:

{* mod.extended.order.status templates - order_customer_cancelled.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}


{$lng.lbl_dear} {$customer.firstname} {$customer.lastname},



Your order was cancelled

<HR size="1" noshade>



<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>

<TR>
        <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/order_invoice.tpl"}

{include file="mail//html/signature.tpl"}

---------- order_customer_failed.tpl ----------
Code:

{* mod.extended.order.status templates - order_customer_failed.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}



{$lng.lbl_dear} {$customer.title} {$customer.firstname} {$customer.lastname},



Your order has not been processed sucessfully for the following reasons:


[*]list reason 1[*]list reason 2



{include file="mail/html/order_invoice.tpl"}



{$lng.eml_thankyou_for_order}

{include file="mail/html/signature.tpl"}

---------- order_customer_process_return.tpl ----------
Code:

{* mod.extended.order.status templates - order_customer_process_return.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}



{$lng.lbl_dear} {$customer.title} {$customer.firstname} {$customer.lastname},



order is being processed for returns


<HR size="1" noshade>



<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>
{if $order.tracking}
<TR>
<TD>{$lng.lbl_tracking_number}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.tracking}</TT></TD>
</TR>
{/if}
<TR>
        <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/order_invoice.tpl"}

{include file="mail/html/signature.tpl"}

---------- order_customer_process_shipping.tpl ----------
Code:

{* mod.extended.order.status templates - order_customer_process_shipping.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}



{$lng.lbl_dear} {$customer.title} {$customer.firstname} {$customer.lastname},



order is scheduled for shipping


<HR size="1" noshade>



<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>
{if $order.tracking}
<TR>
<TD>{$lng.lbl_tracking_number}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.tracking}</TT></TD>
</TR>
{/if}
<TR>
        <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/order_invoice.tpl"}

{include file="mail/html/signature.tpl"}

---------- order_customer_refunded.tpl ----------
Code:

{* mod.extended.order.status templates - order_customer_refunded.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}



{$lng.lbl_dear} {$customer.title} {$customer.firstname} {$customer.lastname},



your return has been accepted, a credit of _blank_ has been issued to you


<HR size="1" noshade>



<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>
{if $order.tracking}
<TR>
<TD>{$lng.lbl_tracking_number}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.tracking}</TT></TD>
</TR>
{/if}
<TR>
        <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/order_invoice.tpl"}

{include file="mail/html/signature.tpl"}


x-online 05-03-2005 05:48 PM

Thank you for your HUGEEEE writing dude. Eventho i might not do it but it is impressive custom mods and great attribution.

jmell 05-04-2005 06:25 PM

Has anyone tried this ????
It sounds really great.

x-light 05-05-2005 11:26 PM

Hello x-online,

Quote:

Thank you for your HUGEEEE writing dude. Eventho i might not do it but it is impressive custom mods and great attribution.


Your welcome. I developed these mods since I need them for my store as well. I am sharing them so hopefully people can benefit from them, give their opinions and even improve on them. Also, it would be great if someone can start customizing the contents of some of these email messages. I just don't have the time to do this, but if I ever get to it, I will post them as well.

Hi jmell,

Quote:

Has anyone tried this ????
It sounds really great.


Unfortunately I can't say I have since I only have access to the latest 4.0.x branch. However if the sql fields for config table is the same and the code in func.php is similar. You may have to do some slight modifications to make it work. If you follow the code in how and where these notifications are being sent in the func.php, it should all make more sense. Good luck.

~x-light

jcnelson 09-02-2005 06:11 PM

We just installed this in X-Cart version 4.0.14 and it works perfect. Thank you so much for posting this.

Awesome work!!

x-light 09-02-2005 10:56 PM

Hello jcnelson,

Your welcome. I am glad it worked for 4.0.14 as well.

~x-light

eaglemobiles 10-14-2005 12:55 AM

Hi,
Its a really great mod, but I cant find the places where to put codes in func.php i searched allot but cant find it.

x-light 10-14-2005 06:31 PM

Hello eaglemobiles,

Humm... Are you using 4.0.11 for your cart? This mod was tested with 4.0.13, but I can't imagine that the func.php in 4.0.11 is that different from the 4.0.13.

~x-light

davidsaldana 11-19-2005 09:13 PM

Has anybody done this for 4.0.16 :?:

HWT 12-03-2005 01:55 PM

I have implimented this successfully in 4.0.13 and 4.0.15 stores. Took about an hour for me to do both stores. All I can say is "WOW"! My orders department NEEDED this! It is obvious that a lot of thought, time, effort and energy was put into this mod. Thanks for sharing!!

HWT 12-03-2005 02:52 PM

We have worked to personalize our business as much as possible, so I've played around with the e-mails to make them easier to edit the messages being given to the customer. I also took the invoices out of the e-mails because they were redundant. The e-mail already had the ordered item information in it.

I used two new language labels in each e-mail. One for the general text, and one for a signature (eml_order_status_signature) that was consistent throughout all the e-mails.

Create a new csv to be imported into languages, or add it to the lng.txt.csv from above. This can be used as a starting point for your language lable text:

Code:

eml_order_status_signature,Orders department,Orders department,E-Mail
eml_oc_cancelled_text,I wanted to let you know that your order has been successfully been cancelled.,"I wanted to let you know that your order  has successfully been cancelled. If there is anything that I can do for you further, please do not hesitate to contact me.",E-Mail
eml_oc_back_in_stock_text,I wanted to drop you this note to let you know that your backordered items are back in stock.,"I wanted to drop you this note to let you know that your backordered items are back in stock and will soon be shipped.  We will e-mail you your tracking numbers as soon as we receive them from the shipper.  If you have any further questions or concerns, please do not hesitate to contact me.",E-Mail
eml_oc_backordered_text,I wanted to drop you this note to let you know that your order is backordered.,"I wanted to drop you this note to let you know that your order is backordered.  We will ship your items as soon as they are back in stock.  If you have any questions or concerns, please do not hesitate to contact me.",E-Mail
eml_oc_process_return_text,I wanted to drop you this note to let you know that your return is being processed.,I wanted to drop you this note to let you know that your return is being processed.,E-Mail
eml_oc_shipping_text,I wanted to drop you this note to let you know that your order has been processed for shipping.,I wanted to drop you this note to let you know that your order has been processed for shipping.,E-Mail
eml_oc_customer_refunded_text,"I wanted to drop you this note to let you know that your return has been processed, and a credit has been issued.","I wanted to drop you this note to let you know that your return has been processed, and a credit has been issues. ",E-Mail


now use these .tpl's for the e-mails:

order_customer_back_in_stock.tpl

Code:

{* mod.extended.order.status templates - order_customer_back_in_stock.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/09/05 *}


{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}



{$lng.lbl_dear} {$customer.firstname} {$customer.lastname},



{$lng.eml_oc_back_in_stock_text}



{$lng.eml_order_status_signature}

<HR size="1" noshade>


 
<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>
{if $order.tracking}
<TR>
<TD>{$lng.lbl_tracking_number}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.tracking}</TT></TD>
</TR>
{/if}
<TR>
  <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/order_invoice.tpl"}

{include file="mail/html/signature.tpl"}


order_customer_backordered_tpl

Code:

{* mod.extended.order.status templates - order_customer_backordered.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}



{$lng.lbl_dear} {$customer.title} {$customer.firstname} {$customer.lastname},



{$lng.eml_oc_backordered_text}



{$lng.eml_order_status_signature}

<HR size="1" noshade>


 
<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>
{if $order.tracking}
<TR>
<TD>{$lng.lbl_tracking_number}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.tracking}</TT></TD>
</TR>
{/if}
<TR>
  <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/signature.tpl"}


order_customer_cancelled.tpl

Code:

{* mod.extended.order.status templates - order_customer_cancelled.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}


{$lng.lbl_dear} {$customer.firstname} {$customer.lastname},



{$lng.eml_oc_cancelled_text}



{$lng.eml_order_status_signature}

<HR size="1" noshade>


 
<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>

<TR>
  <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/signature.tpl"}


order_customer_process_return.tpl

Code:

{* mod.extended.order.status templates - order_customer_process_return.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}



{$lng.lbl_dear} {$customer.title} {$customer.firstname} {$customer.lastname},



{$lng.eml_oc_process_return_text}



{$lng.eml_order_status_signature}

<HR size="1" noshade>


 
<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>
{if $order.tracking}
<TR>
<TD>{$lng.lbl_tracking_number}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.tracking}</TT></TD>
</TR>
{/if}
<TR>
  <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/signature.tpl"}


order_customer_process_shipping.tpl

Code:

{* mod.extended.order.status templates - order_customer_process_shipping.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}



{$lng.lbl_dear} {$customer.title} {$customer.firstname} {$customer.lastname},



{$lng.eml_oc_cancelled_text}



{$lng.eml_order_status_signature}

<HR size="1" noshade>


 
<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>
{if $order.tracking}
<TR>
<TD>{$lng.lbl_tracking_number}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.tracking}</TT></TD>
</TR>
{/if}
<TR>
  <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/signature.tpl"}


order_customer_refunded.tpl

Code:

{* mod.extended.order.status templates - order_customer_refunded.tpl *}
{* arthur: x-light *}
{* work derived from Ruslan R. Fazliev, www.x-cart.com *}
{* version 1.00, 4/08/05 *}

{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}



{$lng.lbl_dear} {$customer.firstname} {$customer.lastname},



{$lng.eml_oc_customer_refunded_text}



{$lng.eml_order_status_signature}

<HR size="1" noshade>


 
<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">
<TR>
<TD width="20%">{$lng.lbl_order_id}:</TD>
<TD width="10"></TD>
<TD width="80%"><TT>#{$order.orderid}</TT></TD>
</TR>
<TR>
<TD>{$lng.lbl_order_date}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.date|date_format:$config.Appearance.datetime_format}</TT></TD>
</TR>
{if $order.tracking}
<TR>
<TD>{$lng.lbl_tracking_number}:</TD>
<TD width="10"></TD>
<TD><TT>{$order.tracking}</TT></TD>
</TR>
{/if}
<TR>
  <TD colspan="3">{include file="mail/html/order_data.tpl"}</TD>
</TR>
</TABLE>



{include file="mail/html/signature.tpl"}


here is an example of the results of the language labels:

Quote:

Dear John Doe,

I wanted to let you know that your order has successfully been cancelled. If there is anything that I can do for you further, please do not hesitate to contact me.

Have a great day,

Nancy Doe
Personal Account Representative
Widgets, Inc.
nancy@widgets.com


I have changed all of my customer e-mails to use this two language label method so I can quickly change either the message being given to customers or the signature through the languages section in the admin, while keeping the look consistent.

Please look through the language csv before uploading to alter it to your needs. I also make no promises about spelling. :wink:

I hope some find this helpful!

A big thanks to x-ligh for sharing this great mod!!!!

groovico 12-04-2005 05:39 AM

x-cart so need to take a good look at this post, 4.1 should have this by default.

The declined status is a classic example, it always causes customers offence, the mod above is an excellent way of showing how it should be implemented.

Very well done :D

ShishaPipeUK 12-04-2005 04:30 PM

Just to let you know this works ok on 4.0.17 as well. The func.php was as described in the above text file.

HWT 12-04-2005 04:36 PM

Just a quick question for x-light.

In the text of order_admin_failed.tpl you have:

Quote:

[*]list reason 1 [*]list reason 2

and in the text in order_customer_refunded.tpl you have:

Quote:

_blank_

What are these supposed to do, and how did you use them effectively?

Thanks!

ShishaPipeUK 12-04-2005 04:49 PM

You would enter your own text, mine was:

order_admin_failed.tpl :


[*]You did not complete your order [*]You canceled your order before paying

order_customer_refunded.tpl:

I wanted to drop you this note to let you know that your return has been processed, and a credit has been issued

x-light 12-04-2005 05:08 PM

Hello all,

Sorry, I didn't get a chance to respond to this thread recently. Been extremely busy lately with multiple projects. I am very delighted that people are finding this mod useful. I implemented this mod to my store as well and it does work great! HWT, many thanks for adding the language contents to the other order status. Keep up the good work, everyone!

BTW, I will be sending a post regarding my first live store. Would appreciate it if I can get some feedbacks.

~x-light

HWT 12-04-2005 05:59 PM

That's what I figured, ShishaPipeUK. What caught me was that the _blank_ was in the middle of the sentance, and unless you have a 1 item or 1 price shop, it would have to be dyanmically generated somehow.

Quote:


your return has been accepted, a credit of _blank_ has been issued to you

Dorette 12-10-2005 12:00 PM

I was able to install the mod,
But as admin I am able to received emails but not the customer,

which file should I take a look at

Dorette 12-20-2005 12:15 PM

I am now able to send emails to cutomers but they receive them the next day, how do I fix that,
As admin I am able to receive mine immediately the order is placed, but the customers receive it the day after.
Is there a file I have to fix.

x-light 12-22-2005 02:36 AM

Quote:

Is there a file I have to fix.


If you are able to receive email on the admin side, you should definitely able to receive email on the customer side. This is because both type of notifications uses the same function call to send the email. So I think there should be nothing wrong this the script.

Maybe this is a host related issue and your host can help you out more. Good luck.

~x-light

Dorette 12-22-2005 05:07 AM

it was definitely a problem on the host side.

apparently I had a huge number of bounced emails due to spam sitting in a queue waiting to be sent.
I has all been cleared now


Thank you all

JWait 01-15-2006 03:54 AM

Does anyone have this mod working successfully in version 4.0.17? The include/func.php is totally different.

ShishaPipeUK 01-15-2006 05:32 AM

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.

electronics4less 02-07-2006 04:19 PM

X-light is the man..his email mod worked perfectly and now this..

Thanks again X-light!

Also this was on v4.0.9. Note for newbies like me, for the lng.txt.csv, when importing be sure to select Comma as the delimeter. Otherwise won't read all of the labels.

shirtshop 02-10-2006 12:21 AM

is this mod also for 3.5.10 ? Who can help us with install? give me your price.

QVS 08-16-2006 09:34 PM

it seems the emails are not coming throught properly. Cant understand it as i followed the mod to a T. so it should work perfectly.

nfc5382 12-24-2006 10:16 AM

Re: extended order status with email notifications
 
thanks!

artist122 12-26-2006 07:34 PM

Re: extended order status with email notifications
 
Has any one got this working for 4.1.3

fractalspin 12-30-2006 09:34 AM

Re: extended order status with email notifications
 
Could someone please post the complete walkthrough for the latest version?

Ed May 01-03-2007 09:02 AM

Re: extended order status with email notifications
 
I'm also interested these changes but for X-Cart 4.1.x

From my inital examination it appears that there is no longer a func.php this has been broken out into separate files in a include/func/

Thanks.

jimmy_ 02-27-2007 06:43 PM

Re: extended order status with email notifications
 
this mod is something ive wanted to do to my cart for sometime. I was thinking I was going to have to get someone to custom code this for me. Thank you very much for this x-light :)

ultimatephysique 04-05-2007 04:10 PM

Re: extended order status with email notifications
 
anyone have this working for 4.1.6?

skeep5 04-13-2007 02:17 PM

Re: extended order status with email notifications
 
Quote:

Originally Posted by ultimatephysique
anyone have this working for 4.1.6?


Anyone?

davidsaldana 04-29-2007 04:10 PM

Re: extended order status with email notifications
 
Great Mod. We also need a hold status, with admin and cust notifications. Anyone know how to do this?

thanks

consultant 06-14-2007 09:00 AM

Re: extended order status with email notifications
 
Bump.

So anyone tried installing this mod on a 4.1.x system?

gardel 07-14-2007 05:39 PM

Re: extended order status with email notifications
 
Quote:

Originally Posted by consultant

So anyone tried installing this mod on a 4.1.x system?


I've installed it on 4.1.8 with some modifications to support the following status states and notification messages:
  • Not Finished
  • Reviewing
  • Failed
  • Fraud
  • Cancelled
  • Pending Wire Transfer
  • Charge Verification
  • Charge Verification (AMEX)
  • Preordered
  • Backordered
  • Back in Stock
  • Processing
  • Preparing to Ship (Released)
  • Partially Shipped
  • Shipped
  • Complete
The core changes go in the include/func/func.order.php file.

JWait 07-24-2007 09:36 AM

Re: extended order status with email notifications
 
Gardel,

After looking at include/func/func.order.php file (for version 4.1.8 ), I couldn't find where most of the code modifications go. Is there any chance you can post the mods you made? Specifically, I am looking to add "Waiting for Payment" (for money orders), "Backordered" (for items out of stock), "Canceled" (for canceled orders), and "Refunded" (for refunds to credit cards), all with customer emails being sent. I have the AOM module but it does not send emails for these (why not for "canceled" I have no idea). Anyway, any help would be appreciated.

Duramax 6.6L 09-03-2007 07:31 PM

Re: extended order status with email notifications
 
I would be interested in seeing a detailed instalation for this mod in 4.1.8.

Vacman 09-10-2007 10:03 PM

Re: extended order status with email notifications
 
I too would be interested in a complete posting for 4.1.8 as well.

chris.barber 10-31-2007 03:04 PM

Re: extended order status with email notifications
 
Gardel or anyone else who can help, I am running 4.1.9, but this is almost identical to 4.1.8 so I would also be interested in anything else you changed, I think I am just about there with getting this to work, the only issue I have is the order_status.tpl file is not right, and I have tried all combinations to fix it, the problem I have is if I pick shipping for example as the status, the tool goes through the process of updating it and then returns to the orders management screen with the status unchanged.

Any ideas anyone?


All times are GMT -8. The time now is 05:34 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.