欢迎来到DESIPO.COM,外贸电子商务整合专家!登录 | 免费注册 ?
会员优惠 | 软件下载 | 客服中心 | 收藏本站 | 购物车[0件]


Zen Cart 订单号格式修改

编辑时间2014年 01月 12日 查看全部评论 写评论
Zen Cart 订单号格式修改zen cart的订单号 大家都知道是从1开始的
对用户来说以猜解,同时体验不好,
而直接修改数据库中的orders_id 加大它的值 不能超过10位数
一般我们比较喜欢日期时间加随机数的订单号 比如 2010120716020001 作为订单号
这已经16位数了
怎样才能更好的增加个订单号呢
我们只能来另外再添加个字段作为订单号! LIGHTINTHEBOX就是这样的形式 体验非常好
这修改需要一定的编程技术,不懂技术的请做好备份 谨慎操作

------------------------------------------------------------------
在数据库里添加订单号字段
orders 表 orders_number
`orders_number` varchar(100) NOT NULL,

------------------------------------------------------------------
includes/classes/order.php 文件

function create($zf_ot_modules, $zf_mode = 2) {
global $db, $zco_notifier;
下面插入
 
  
    $order_number_time = date("YmdHis");
    $order_number_2 = rand(10000,99999);
    $order_number = $order_number_time . $order_number_2;
   


$sql_data_array = array('customers_id' => $_SESSION['customer_id'] 下面修改插入为
$sql_data_array = array('orders_number' => $order_number,
                                       'customers_id' => $_SESSION['customer_id'],


订单的显示——后台


admin/orders.php 
文件
修改
zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status');

zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $check_status->fields['orders_number'], $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status');

修改
zen_mail('', SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra');

zen_mail('', SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $check_status->fields['orders_number'], $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra');


admin/includes/classes/order.php  文件
修改
$order = $db->Execute("select cc_cvv, customers_name, customers_company, customers_street_address,

$order = $db->Execute("select cc_cvv, orders_number, customers_name, customers_company, customers_street_address,

修改
$this->info = array('currency' => $order->fields['currency'],

$this->info = array('currency' => $order->fields['currency'],
                                 'orders_number' => $order->fields['orders_number'],




admin/invoice.php文件
修改
<td class="main"><b><?php echo ENTRY_ORDER_ID . $oID; ?></b></td>

<td class="main"><b><?php echo ENTRY_ORDER_ID . $order->info['orders_number']; ?></b></td>


admin/packingslip.php
修改
<td class="main"><b><?php echo ENTRY_ORDER_ID . $oID; ?></b></td>

<td class="main"><b><?php echo ENTRY_ORDER_ID . $order->info['orders_number']; ?></b></td>


adminincludesfunctionsgeneral.php文件
增加
  function zen_get_order_orders_number($orders_id) {
    global $db;

    $order_query = "select orders_number
                      from " . TABLE_ORDERS . "
                      where orders_id = '" . (int)$orders_id . "'";

    $order = $db->Execute($order_query);

    return $order->fields['orders_number'];
  }


admin/gv_queue.php文件
修改
<td class="dataTableContent" align="center"><?php echo $gv_list->fields['order_id']; ?></td>

<td class="dataTableContent" align="center"><?php echo zen_get_order_orders_number($gv_list->fields['order_id']); ?></td>

------------------------------------------------------------------


订单的显示——前台

includes/classes/order.php  文件
修改
$order_query = "select customers_id, customers_name, customers_company,

$order_query = "select orders_number, customers_id, customers_name, customers_company,
修改
$this->info = array('currency' => $order->fields['currency'],

$this->info = array('currency' => $order->fields['currency'],
                                 'orders_number' => $order->fields['orders_number'],

修改
EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "n" .

EMAIL_TEXT_ORDER_NUMBER . ' ' . zen_get_order_orders_number($zf_insert_id) . "n" .

修改
zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);

zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . zen_get_order_orders_number($zf_insert_id), $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);

修改
zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,

zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . zen_get_order_orders_number($zf_insert_id),



includes/modules/pages/account/header_php.php文件
修改
$orders_query = "SELECT o.orders_id, o.date_purchased, o.delivery_name,

$orders_query = "SELECT o.orders_id, o.orders_number, o.date_purchased, o.delivery_name,

修改
$ordersArray[] = array('orders_id'=>$orders->fields['orders_id'],

$ordersArray[] = array('orders_id'=>$orders->fields['orders_id'],
                                     'orders_number'=>$orders->fields['orders_number'],


includes/templates你的模板templates/tpl_account_default.php文件
修改
<td width="30px"><?php echo TEXT_NUMBER_SYMBOL . $orders['orders_id']; ?></td>

<td width="30px"><?php echo TEXT_NUMBER_SYMBOL . $orders['orders_number']; ?></td>


includes/templates你的模板templates/tpl_account_history_info_default.php文件
修改
<?php echo HEADING_TITLE . ORDER_HEADING_DIVIDER . sprintf(HEADING_ORDER_NUMBER, $_GET['order_id']); ?>

<?php echo HEADING_TITLE . ORDER_HEADING_DIVIDER . sprintf(HEADING_ORDER_NUMBER, $order->info['orders_number']); ?>


includes/modules/pages/account_history_info/header_php.php文件
修改
$breadcrumb->add(sprintf(NAVBAR_TITLE_3, $_GET['order_id']));

$breadcrumb->add(sprintf(NAVBAR_TITLE_3, $order->info['orders_number']));
并移动到
$order = new order($_GET['order_id']);
下面


includes/modules/pages/account_history/header_php.php文件
修改
$history_query_raw = "SELECT o.orders_id, o.date_purchased, o.delivery_name,

$history_query_raw = "SELECT o.orders_id, o.orders_number, o.date_purchased, o.delivery_name,


includes/templates你的模板templates/tpl_account_history_default.php文件
修改
<?php echo TEXT_ORDER_NUMBER . $history['orders_id']; ?>

<?php echo TEXT_ORDER_NUMBER . $history['orders_number']; ?>


includesmodulespagescheckout_successheader_php.php文件
修改
$zv_orders_id = (isset($_SESSION['order_number_created']) && $_SESSION['order_number_created'] >= 1) ? $_SESSION['order_number_created'] : $orders_id;

$zv_orders_id = $orders->fields['orders_number'];

注释掉
//$orders_id = $zv_orders_id;


includesfunctionsfunctions_lookups.php文件
增加
  function zen_get_order_orders_number($orders_id) {
    global $db;

    $order_query = "select orders_number
                      from " . TABLE_ORDERS . "
                      where orders_id = '" . (int)$orders_id . "'";

    $order = $db->Execute($order_query);

    return $order->fields['orders_number'];
  }




没有评论
Copyright © 2012-2013 迪赛普科技 版权所有

合作邮箱:admin@desipo.com 合作QQ:76052083