![]() |
zen-cart 按时间+随机数结合产生订单号 (订单方便管理与确认)
注意:
修改前一定要备份好自己的数据库!!! 把orders字段中orders_id 的 Auto_increment 关闭; 1、在 function create($zf_ot_modules, $zf_mode = 2) { global $db;下插入 /*------按时间+随机数结合产生订单号-----*/ $t1 = date("Ymd"); srand ((float) microtime() * 10000000); $input = array ("1", "2", "3", "4", "5", "6", "7", "8", "9", "0"); $rand_keys = array_rand ($input, 2); //$t1 = $input[$rand_keys[0]]; $t2 = $input[$rand_keys[1]]; $t3 = rand(0,9); $ordernum = $t1.$t2.$t3; /*------------------------------------*/ 2、 if ($_SESSION['shipping'] == 'free_free') { $this->info['shipping_module_code'] = $_SESSION['shipping']; }插入 /*在这里添加orders_id字段,手工插入:*/ $sql_data_array = array('orders_id' => $ordernum, 3、 zen_db_perform(TABLE_ORDERS, $sql_data_array);插入修改 /*修改原来的调用自动插入函数为$ordernum变量*/ $insert_id = $ordernum; // $insert_id = $db->Insert_ID(); for ($i=0, $n=sizeof($zf_ot_modules); $i<$n; $i++) { $sql_data_array = array('orders_id' => $insert_id, 以上简单的修改后,订单号会输出如:20101201013334985 表示:20010年12月1日1时33分34秒985随机数 原mod出处:www.oscommerce.com;我修改了日期显示及订单号排列顺序。 http://modyourzencart.com/fdownload/download.php?file=2 对比之 另外一个修改订单号模块 |
| All times are GMT +8. The time now is 10:28 AM. |
Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.