网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > ZenCart
User Name
Password
 
FAQ Members List Calendar Cheap Glasses Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1   IP: 122.195.220.37
Old 2012-12-21, 07:36 PM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default 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 对比之 另外一个修改订单号模块
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Modify Zen Cart to Use External Images 上海公司注册 ZenCart 0 2012-06-21 11:56 AM
有关Zen Cart的一些常用操作 yahoo ZenCart 0 2009-12-01 09:36 PM
How to Install an Zen Cart Template topvip ZenCart 0 2009-08-23 05:35 PM
X-Cart Multiple Input Validation Holes Permit SQL Injection and Cross-Site Scripting topvip X-Cart 0 2009-07-21 10:03 AM
x-cart Template Editing Guide for 4.1.x topvip X-Cart 0 2009-04-15 11:42 PM

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 12:16 PM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.