登录后,购买下载资源更方便!
您需要 登录 才可以下载或查看,没有账号?立即注册
×
针对ecshop订单中的物品,需要支持拣货的状态,比如未拣货、拣货中、拣货完成,以及显示拣货人姓名。; N7 x% E& _( `+ J% b8 v8 e! d3 k7 b2 l0 u
$ y+ r) z* I) H8 d: Z
1.SQL操作:
6 B3 ]% y4 M A; y; V5 _2 D! n2 k
2.在文件languages\zh_cn\admin\order.php中增加:
9 Z6 y6 N- X( S* w$ z4 G& R! I, t# e+ T8 W
/* 拣货 */
( v7 }9 h. s2 q# h C( k- u$_LANG['order_picking_status'] = '拣货状态';
" {9 C* `; o1 J- T+ j4 T0 G+ ]0 `$_LANG['order_picking_status_none'] = '未拣货';
' x, @( J9 C% Y5 l! h h: s$_LANG['order_picking_status_processing'] = '拣货中';/ \ P2 V5 w& b9 n, ~6 e
$_LANG['order_picking_status_finish'] = '拣货完成';7 |$ p& B0 `5 X. d
$_LANG['invalid_order_picking_status'] = '拣货状态无效。0:未拣货;1:拣货中;2:拣货完成';/ h5 f$ @% H" N+ }- X. W3 c% a
v3 _: _! t$ A7 e9 n
6 I; ^/ y& B7 M. X0 f3.文件admin\templates\order_list.htm中在一下两行之间:. v* a, r7 B, N3 r$ C, z+ T
第一个地方% b9 J( w: e! r: y' W6 L) F* O
<th>{$lang.all_status}</th>
3 a3 a/ [/ j% z! Q" A6 W. n, z& ~<th>{$lang.handler}</th>
% r Q$ z8 t) Q. C中间加上
2 z$ p9 N( C9 V2 A# V<th>{$lang.order_picking_status}</th>$ x6 D' x a) I" A8 H8 @
" a+ V0 G6 G% B0 ^6 G' I9 o
第二个地方
1 z8 A% P k6 S u4 ]6 L在<td align="center" valign="top" nowrap="nowrap">{$lang.os[$order.order_status]},{$lang.ps[$order.pay_status]},{$lang.ss[$order.shipping_status]}</td>
8 Z$ t! B4 w5 Z: [* s8 b7 W后面加上$ H* @& A6 ^- |- P+ F5 @3 m
<td align="right" valign="top"nowrap="nowrap"><span>{$order.user_name}【{if $order.order_picking_status == 1}{$lang.order_picking_status_processing}{elseif $order.order_picking_status ==2} {$lang.order_picking_status_finish} {else}{$lang.order_picking_status_none}{/if}】</span></td>
2 A) w0 W y5 a6 X U3 Y1 R* v Y8 |$ ^8 M2 B
$ f2 s" G0 Q& t+ C* e; A) b- B. [9 x1 \
5 }. Y) L! B# l8 }: H4.admin\js\listtable.js中,listTable.edit的响应函数修改如下:
! K1 N% u, {9 M8 C+ S8 p, Z8 i+ v$ Q9 n$ |
' M3 ~. d8 i/ k, i0 n+ x* T; \
/** * 创建一个可编辑区 */ listTable.edit = function(obj, act, id) { var tag =obj.firstChild.tagName; if (typeof(tag) !="undefined" && tag.toLowerCase() == "input") { return; } /* 保存原始的内容 */ var org = obj.innerHTML; var val = Browser.isIE ?obj.innerText : obj.textContent; /* 创建一个输入框 */ var txt =document.createElement("INPUT"); txt.value = (val == 'N/A') ?'' : val; txt.style.width =(obj.offsetWidth + 12) + "px" ; /* 隐藏对象中的内容,并将输入框加入到对象中 */ obj.innerHTML =""; obj.appendChild(txt); txt.focus(); txt.select(); /* 编辑区输入事件处理函数 */ txt.onkeypress = function(e) { var evt =Utils.fixEvent(e); var obj =Utils.srcElement(e); if (evt.keyCode == 13)//www.zuimoban.com { obj.blur(); return false; } if (evt.keyCode == 27) { obj.parentNode.innerHTML= org; } } /* 编辑区失去焦点的处理函数 */ txt.onblur = function(e) { if(Utils.trim(txt.value).length > 0) { res =Ajax.call(listTable.url, "act="+act+"&val=" +encodeURIComponent(Utils.trim(txt.value)) + "&id=" +id, null,"POST", "JSON", false); if (res.message) { alert(res.message); } if(res.id &&(res.act == 'goods_auto' || res.act == 'article_auto')) { document.getElementById('del'+res.id).innerHTML = "<ahref=\""+ thisfile +"?goods_id="+ res.id+"&act=del\" onclick=\"returnconfirm('"+deleteck+"');\">"+deleteid+"</a>"; } obj.innerHTML = (res.error== 0) ? res.content : org; } else { obj.innerHTML = org; } if (act =='edit_is_validated') { var content = obj.innerHTML.trim(); if (content == '1' || content.indexOf("yes") >= 0) { obj.innerHTML = '<imgsrc="images/yes.gif">'; } else { obj.innerHTML ='<img src="images/no.gif">'; } } else if (act =='edit_order_picking_status') { if (org == obj.innerHTML) { return true; } if (obj.innerHTML == '1') { obj.innerHTML ="【拣货中】"; } else if (obj.innerHTML == '2') { obj.innerHTML ="【拣货完成】"; } else { obj.innerHTML ="【未拣货】"; } } else { } } : l, [5 p8 V& Y( |, \( \! i
} 5 P1 [, ^( m) w: d6 l
5.admin\order.php文件中增加下面的函数:
9 _: ^3 M- N! S e- X6 l8 |4 q+ ]- }# ]* Y0 J0 _+ I! V9 c
/*------------------------------------------------------ */8 Z. p9 } I6 \
//-- 订单拣货状态查询
# |) |7 Z" _8 d6 x+ Z6 T% X6 M h/*------------------------------------------------------ */
. g& f2 T) b- |7 d$ v , J4 K9 Q+ N- ]
if ($_REQUEST['act'] == 'edit_order_picking_status')2 h6 F0 }- T% @/ |* X
{
5 Z" T9 Q! \, [1 E4 E4 m6 M8 t `% k /* 检查权限 */( s6 y# E- O# O& `
check_authz_json('users_manage');! t1 Y; o6 }5 Y$ b" g
4 V& A4 H D: r) o9 Y
$id =empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']);
! G& @2 I ?! m8 D: d $order_picking_status =empty($_REQUEST['val']) ? '' : json_str_iconv(trim($_REQUEST['val']));* z* @/ o0 A. N1 f1 `/ i
2 F* @/ G5 B1 m; z
$sql = "DELETE fromorder_picking_status WHERE order_id = '". $id ."' LIMIT 1";
* B5 |$ j% ~/ l2 J5 y $db->query($sql);
" n% {, `& R+ I7 f: k8 H* @ * j) F& t' {3 ^8 J4 D
$sql = "INSERT INTOorder_picking_status (order_id, user_name, order_picking_status) VALUES('". $id ."', '". $_SESSION['admin_name'] ."', '".$order_picking_status ."')";
1 }8 S6 v( r1 @* N( i$ P9 G0 } $db->query($sql);4 L' v9 P& v' }8 @! R% f# }- [
# v) d- E5 O6 x2 W. | if ($order_picking_status> 2 || $order_picking_status < 0)
' Z3 L/ k) V4 m* c, w {
, t0 M* B9 j% Z i" F) P3 z make_json_error($GLOBALS['_LANG']['invalid_order_picking_status']);( C$ I7 c' o) M# R5 v
}& {; q! g( ^& K# `- I6 O
else7 v" _+ a! R9 |/ [
{
$ q) r* V$ D2 ^* J make_json_result($order_picking_status);+ q+ Y% s+ t5 v7 y' h
}
+ C( {4 \4 f- I5 q" l: ]7 A}' K6 w9 ?# Z) g- d* h8 S5 K
5 k, f, o3 i$ d4 x" l$ d% p6、admin\order.php文件中增加下面的函数将以下代码
8 P: {+ q+ }# ] /* 查询 */
9 j3 H& K, A- A- L* [4 [8 h$sql = "SELECT o.*," .) r; r( A- O$ K) p2 N5 a: j
"o.pay_status, o.consignee, o.firstname, o.lastname, o.address, o.email, o.tel, o.extension_code, o.extension_id, " .
$ T4 e x+ `' ^: s. G "(" . order_amount_field('o.') . ") AS total_fee, " . H3 H- {; c2 u9 ]6 B7 Q
"IFNULL(u.user_name, '" .$GLOBALS['_LANG']['anonymous']. "') AS buyer ".5 @6 I4 \. C- @
" FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " .4 o( Q! {& {3 `
" LEFT JOIN " .$GLOBALS['ecs']->table('users'). " AS u ON u.user_id=o.user_id ". $where .
5 Z. @& H# d9 ` o " ORDER BY $filter[sort_by] $filter[sort_order] ".' @: @" k' ^) @7 _0 P4 M# B; O1 R
" LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",$filter[page_size]"; + b/ v K1 x! u- w" E5 Y+ ~4 T
修改为:2 y6 {/ t* n9 }9 q' `8 e" n
//* 查询 */
- J9 O. j8 q" l, E $sql = "SELECT o.*," .! k4 u' d: k* q2 s g& U* C( Z
"o.pay_status, o.consignee, o.firstname, o.lastname, o.address, o.email, o.tel, o.extension_code, o.extension_id, " .1 `: V- t7 }; d2 Y
"(" . order_amount_field('o.') . ") AS total_fee, " .
! ?+ W) G5 [' b. V- T/ X "IFNULL(u.user_name, '" .$GLOBALS['_LANG']['anonymous']. "') AS buyer , p.user_name, p.order_picking_status, r.order_reply_status ".) S2 N% r: t9 b3 j8 Y/ w+ \ G1 Q
" FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " .
7 N6 A8 x! Z& i+ j: v2 m " LEFT JOIN " .$GLOBALS['ecs']->table('users'). " AS u ON u.user_id=o.user_id ".
. u3 D) n& O/ U, w' C( A* a " LEFT JOIN order_reply_status AS r ON r.order_id = o.order_id ". . t J# X4 M" w( ~3 r
" LEFT JOIN order_picking_status AS p ON p.order_id = o.order_id ". $where .2 v! I2 r3 L8 y/ p1 [* j; p2 @
" ORDER BY $filter[sort_by] $filter[sort_order] ".
+ @: j. V" @7 A- f1 W$ [5 | " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",$filter[page_size]";
% O9 c. ` U! o7 Z) J4 X, {% ]8 Z( `' C3 Y* r
, y& T; a, d3 Z f& c" [
; K* B/ b' P& G- a% h5 O
|