Below is an outline for adding a new order status to x-cart 4.1.x using, a "Refunded" status to illustrate the process. This modification will set the order status to refunded, return the products to stock, and automatically notify the customer about the refund.
Open skin1/main/order_status.tpl
FIND:
Code:
<option value="I"{if $status eq "I"} selected="selected"{/if}>{$lng.lbl_not_finished}</option>
AFTER ADD:
Code:
<option value="R"{if $status eq "R"} selected="selected"{/if}>Refunded</option>
FIND:
Code:
{if $status eq "I"}{$lng.lbl_not_finished}
AFTER ADD:
Code:
{elseif $status eq "R"}Refunded
Open include/func/func.order.php
FIND:
Code:
$allowed_order_status = 'IQPBDFC';
REPLACE WITH:
Code:
$allowed_order_status = 'IRQPBDFC';
FIND:
Code:
elseif ($status == "D" && $order["status"] != "D" && $order["status"] != "F") {
func_decline_order($orderid, $status);
}
AFTER ADD:
Code:
// Custom Refund Function
elseif ($status == "R" && $order["status"] != "R") {
// Return products to stock
func_update_quantity($order_data["products"]);
// Send email notification to user
$userinfo = $order_data["userinfo"];
$mail_smarty->assign("customer",$userinfo);
func_send_mail($userinfo["email"], "mail/order_refunded_subj.tpl", "mail/order_refunded.tpl", $config["Company"]["orders_department"], false);
}
Add language variable:
Log into your x-cart admin section, and click on "Languages." Select your primary language and add the following variable under "Labels."
lbl_wcm_refunded - Refunded
Add autoresponders:
The attached autoresponders can be modified and uploaded for automatic customer notification.