ecshop会员中心增加订单搜索功能
2009-09-07 16:14 来源:www.chinab4c.com 作者:ecshop专家
在user.php中的act=order_list中增加以下程序。
$order_sn = isset($_REQUEST['order_sn'])?$_REQUEST['order_sn']:'';
$consignee = isset($_REQUEST['consignee'])?$_REQUEST['consignee']:'';
$start_date = isset($_REQUEST['start_date'])?$_REQUEST['start_date']:'';
$end_date = isset($_REQUEST['end_date'])?$_REQUEST['end_date']:'';
$pay_status = isset($_REQUEST['pay_status'])?$_REQUEST['pay_status']:'';
$shipping_status = isset($_REQUEST['shipping_status'])?$_REQUEST['shipping_status']:'';
$order_status = isset($_REQUEST['order_status'])?$_REQUEST['order_status']:'';
$where ="";
if($order_sn){
$where.=" and order_sn ='$order_sn'";
}
if($consignee){
$where.=" and consignee = '$$consignee'";
}
if($start_date){
$t = strtotime($start_date);
$where.=" and add_time >= $t";
}
if($end_date){
$t = strtotime($end_date);
$where.=" and add_time <= $t";
}
if($pay_status && $pay_status!= '-1'){
$where.=" pay_status = '$pay_status'";
}
if($shipping_status && $shipping_status!= '-1'){
$where.=" and shipping_status = '$shipping_status'";
}
if($order_status && $order_status!= '-1'){
$where.=" and order_status = '$order_status'";
}
$record_count = $db->getOne("SELECT COUNT(*) FROM " .$ecs->table('order_info'). " WHERE user_id = '$user_id' $where");
$pager = get_pager('user.php', array('act' => $action,'order_status'=>$order_status,'order_sn'=>$order_sn,'consignee'=>$consignee,'start_date'=>$start_date,'end_date'=>$end_date,'pay_status'=>$pay_status,'shipping_status'=>$shipping_status), $record_count, $page);
$orders = get_user_orders($user_id, $pager['size'], $pager['start']);
$merge = get_user_merge($user_id);
$smarty->assign('os_list', get_status_list('order'));
$smarty->assign('ps_list', get_status_list('payment'));
$smarty->assign('ss_list', get_status_list('shipping'));
$smarty->assign('merge', $merge);
$smarty->assign('pager', $pager);
$smarty->assign('orders', $orders);
$smarty->display('user_transaction.dwt');
在分页模板中,传递要查询的参数。
2:模板中增加以下程序。用于搜索表单
<link href="js/calendar/calendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/calendar.php"></script>
<tr align="center">
<td bgcolor="#ffffff" colspan="5"><div align="left">订单编号
<input type="hidden" name="act" value="order_list">
<input type="text" name="order_sn"><br>
收货人姓名
<input type="text" name="consignee">
<br>
下单时间 <input name="start_date" value="{$start_date}" style="width:80px;" onclick="return showCalendar(this, '%Y-%m-%d', false, false, this);" />
-
<input name="end_date" value="{$end_date}" style="width:80px;" onclick="return showCalendar(this, '%Y-%m-%d', false, false, this);" />
<br>
订单状态: <select name="order_status" id="select9">
<option value="-1">请选择</option>
{html_options options=$os_list selected=-1}
</select>
付款状态: <select name="pay_status" id="select11">
<option value="-1">请选择</option>
{html_options options=$ps_list selected=-1}
</select>
发货状态: <select name="shipping_status" id="select10">
<option value="-1">请选择</option>
{html_options options=$ss_list selected=-1}
</select> <input type="submit" value="搜索"></div></td>
</tr>
3:将以下搜索条件加到搜索函数中去。在includes/lib_transaction.php中ecshop函数get_user_orders()中
$order_sn = isset($_REQUEST['order_sn'])?$_REQUEST['order_sn']:'';
$consignee = isset($_REQUEST['consignee'])?$_REQUEST['consignee']:'';
$start_date = isset($_REQUEST['start_date'])?$_REQUEST['start_date']:'';
$end_date = isset($_REQUEST['end_date'])?$_REQUEST['end_date']:'';
$pay_status = isset($_REQUEST['pay_status'])?$_REQUEST['pay_status']:'';
$shipping_status = isset($_REQUEST['shipping_status'])?$_REQUEST['shipping_status']:'';
$order_status = isset($_REQUEST['order_status'])?$_REQUEST['order_status']:'';
$where ="";
if($order_sn){
$where.=" and order_sn ='$order_sn'";
}
if($consignee){
$where.=" and consignee = '$$consignee'";
}
if($start_date){
$t = strtotime($start_date);
$where.=" and add_time >= $t";
}
if($end_date){
$t = strtotime($end_date);
$where.=" and add_time <= $t";
}
if($pay_status && $pay_status!= '-1'){
$where.=" pay_status = '$pay_status'";
}
if($shipping_status && $shipping_status!= '-1'){
$where.=" and shipping_status = '$shipping_status'";
}
if($order_status && $order_status!= '-1'){
$where.=" and order_status = '$order_status'";
}
以上步骤,就完成了ecshop会员中心订单搜索功能。
相关文章:
来源:中国B4C电子商务
最近更新
常用插件
- ecshop红包修改成满多少减
我们在长期使用ecshop的时候,我们可以发现。ecshop的红包是一个非常强...
- ecshop通用红包编码
很多时候,为了结合促销,必须扩展一下ecshop的红包功能。ecshop的红包...
- ecshop购物车功能改进[插件
ecshop购物车功能改进[插件套餐]主要是我们最近开发工作和开发项目中。...
- ecshop分类树中统计商品数
最近忙于开发其他项目,在不少朋友不断要求和催促的情况下,做出了该小...
- ecshop降价通知登记插件
ecshop降价通知登记插件,主要是为了方便某些客户,对商品价格要求比...