论坛一定有高手! 增加订单搜索功能

2016-07-07 15:03 来源:www.chinab4c.com 作者:ecshop专家



我想实现如下一个功能,在用户中心——我的订单,订单详情页面增加 订单搜索功能。因为我是做代发货的,所以代理商得有这个功能才方便查询自己的订单,不然订单一多,就乱了。 高手帮忙指导下呀,谢谢~~




回答:
这个是我在ShopEx 论坛上找到的,有人发布了这个功能,非常强大哦,可是我不知道在ecshop上如何更改,高手们浮出来吧,这功能挺实用的,大家顶起来,这个应该蛮需要的。






新建立一个 : memberorders.php 文件

代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>显示会员订单搜索</title>
</head>

<body>



<?php

require('dbconn.php');
echo "<link rel=\"stylesheet\" href=\"".$webpath."statics/style.css\" type=\"text/css\" />";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$webpath."themes/boom/images/css.css\" />";




$page=isset($_GET['page'])?intval($_GET['page']):1;

$rowid=isset($_GET['rowid'])?intval($_GET['rowid']):1;
$member_id=isset($_GET['member_id'])?intval($_GET['member_id']):0;
$num=10;
$db=mysql_connect($host,$dbusername,$dbpwd);
$select=mysql_select_db($dbname,$db);
mysql_query("SET NAMES 'UTF8'");








if (!empty($_REQUEST['keyword']))
{
if($rowid==1)
{
$total=mysql_num_rows(mysql_query("select order_id from sdb_orders where order_id =conv('".dec2hex(trim($_REQUEST['keyword']))."', 16, 10) anddisabled=\"false\" and member_id = $member_id"));
$offset=($page-1)*$num;
$info=mysql_query("select * from sdb_orders where order_id =conv('".dec2hex(trim($_REQUEST['keyword']))."', 16, 10) anddisabled=\"false\" and member_id = $member_id order by createtime desc limit $offset,$num");
}
elseif($rowid ==2)
{
$keyword =trim($_REQUEST['keyword']);
$total=mysql_num_rows(mysql_query("select order_id from sdb_orders where ship_name = '".$keyword."' anddisabled=\"false\" and member_id = $member_id order by createtime desc"));
$offset=($page-1)*$num;
$info=mysql_query("select * from sdb_orders where ship_name = '".$keyword."' anddisabled=\"false\" and member_id = $member_id order by createtime desc limit $offset,$num");
}
else
{
$total=mysql_num_rows(mysql_query("select order_id from sdb_orders where disabled=\"false\" and member_id = $member_id order by createtime desc"));
$offset=($page-1)*$num;
$info=mysql_query("select * from sdb_orders where disabled=\"false\" and member_id = $member_id order by createtime desc limit $offset,$num");
}
}
else
{
$total=mysql_num_rows(mysql_query("select order_id from sdb_orders where disabled=\"false\" and member_id = $member_id order by createtime desc"));
$offset=($page-1)*$num;
$info=mysql_query("select * from sdb_orders where disabled=\"false\" and member_id = $member_id order by createtime desc limit $offset,$num");
}








$pagenum=ceil($total/$num);



echo "<form action=\"memberorders.php\"method=\"get\">";
echo "<select name=\"rowid\">";
if ($rowid==1)
{
echo "<option value=\"1\" selected=\"selected\">按订单号查询</option>";
echo "<option value=\"2\">按收货人姓名查询</option>";
}
else
{
echo "<option value=\"1\" >按订单号查询</option>";
echo "<option value=\"2\" selected=\"selected\">按收货人姓名查询</option>";
}


echo "</select>";
echo "<input name=\"keyword\" type=\"text\" /> ";
echo "<input name=\"member_id\" type=\"hidden\" value=\"".$member_id."\">";

echo "<input type=\"submit\" name=\"Submit\" value=\"搜索\" id=\"Submit\" /></form><br>";
If($page>$pagenum || $page == 0){
Echo "未搜索到任何订单";
Exit;
}

functiondec2hex($number)
{
$hexvalues=array('0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F');
$hexval='';
while($number!='0')
{
$hexval=$hexvalues[bcmod($number,'16')].$hexval;
$number=bcdiv($number,'16',0);
}
return$hexval;
}

function jinzhih_G1($zifu,$jinzhi,$w)
{ $shu= "";
for ($i=0;$i<=strlen($zifu)-1;$i++)
{
$linshi = substr($zifu,$i,1);
switch ($jinzhi){
case 2:
$shu = bindec($zifu);
$i=strlen($zifu)+1;
break;
case 8:
$shu = octdec($zifu);
$i=strlen($zifu)+1;
break;
case 16:
$shu = hexdec($zifu);
$i=strlen($zifu)+1;
break;
case 36:
if (ord($linshi)<=57)
{$shu=bcadd($shu,bcmul((ord($linshi)-48),bcpow($jinzhi,strlen($zifu)-$i-1)));
}else{
$shu=bcadd($shu,bcmul((ord($linshi)-55),bcpow($jinzhi,strlen($zifu)-$i-1)));}
break;
case 62:
if (ord($linshi)<=57)
{$shu=bcadd($shu,bcmul($linshi,bcpow($jinzhi,strlen($zifu)-$i-1)));
}elseif ((ord($linshi)>=65) && (ord($linshi)<=90)){
$shu=bcadd($shu,bcmul((ord($linshi)-55),bcpow($jinzhi,strlen($zifu)-$i-1)));
}else{
$shu=bcadd($shu,bcmul((ord($linshi)-61),bcpow($jinzhi,strlen($zifu)-$i-1)));
}
break;
}
}
return $shu;}

echo "<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" class=\"liststyle\"> ";
echo "<col class=\"span-2 ColColorGray\"></col> ";
echo "<!--<col></col>--> ";
echo "<col class=\"span-3\"></col> ";
echo "<col class=\"span-2 ColColorOrange\"></col> ";
echo "<col class=\"span-3\"></col> ";
echo "<thead> ";
echo "<tr> ";
echo " <th>订单号</th> ";
echo "<th>收货人姓名</th> ";
echo "<th>总金额</th> ";
echo " <th>快递单号</th> ";
echo " <th>订单状态</th> ";
echo "</tr> ";
echo "</thead> ";
echo "<tbody> ";
$i=1;
While($it=mysql_fetch_array($info)){

$logi_no=mysql_fetch_row(mysql_query("selectlogi_nofromsdb_deliverywhere type = \"delivery\" and order_id =".$it['order_id']." order by delivery_id desc"));
if ($logi_no !== false)
{
$templogi_np = $logi_no[0];
}
else
{
$templogi_np = "";
}

echo "<tr>";
echo "<td class=\"textwrap\" bgcolor=\"#FFFFFF\"><a href=\"".$webpath."?member-".$it['order_id']."-orderdetail.html\" target=\"_parent\">".$it['order_id']."</a></td>";
echo "<td class=\"textwrap\"bgcolor=\"#FFFFFF\">".$it['ship_name']."</td>";
echo "<td class=\"textright\" bgcolor=\"#FFFFFF\">".$it['final_amount']."</td>";
echo "<td class=\"textright\" bgcolor=\"#FFFFFF\"> ".$templogi_np."</td>";
echo "<td class=\"textwrap\"bgcolor=\"#FFFFFF\">";

if ($it['status'] == "finish")
{
echo "已完成";
}
elseif($it['status'] == "dead")
{
echo "已作废";

}
else
{
if ($it['pay_status'] == 1)
{
echo "已付款";
if ($it['ship_status'] == 1)
{
echo "[已发货]";
}
elseif ($it['ship_status'] == 2)
{
echo "[部分发货]";
}
elseif ($it['ship_status'] == 3)
{
echo "[部分退货]";
}
elseif ($it['ship_status'] == 4)
{
echo "[已退货]";
}
else
{
echo "[正在备货]";
}
}

elseif ($it['pay_status'] == 2)
{
echo "已付款至担保方";
}
elseif ($it['pay_status'] == 3)
{
echo "<a href=\"".$webpath."?member-".$it['order_id']."-orderpay.html\" target=\"_parent\">等待补款</a>";
if ($it['ship_status'] == 1)
{
echo "[已发货]";
}
elseif ($it['ship_status'] == 2)
{
echo "[部分发货]";
}
elseif ($it['ship_status'] == 3)
{
echo "[部分退货]";
}
elseif ($it['ship_status'] == 4)
{
echo "[已退货]";
}
}
elseif ($it['pay_status'] == 4)
{
echo "部分退款";
if ($it['ship_status'] == 1)
{
echo "[已发货]";
}
elseif ($it['ship_status'] == 2)
{
echo "[部分发货]";
}
elseif ($it['ship_status'] == 4)
{
echo "[已退货]";
}
elseif ($it['ship_status'] == 0)
{
echo "[未发货]";
}
}
elseif ($it['pay_status'] == 5)
{
echo "已退款";
if ($it['ship_status'] == 1)
{
echo "[已发货]";
}
elseif ($it['ship_status'] == 2)
{
echo "[部分发货]";
}
elseif ($it['ship_status'] == 4)
{
echo "[已退货]";
}
elseif ($it['ship_status'] == 0)
{
echo "[未发货]";
}
}
else
{
echo "<a href=\"".$webpath."?member-".$it['order_id']."-orderpay.html\" target=\"_parent\">等待付款</a>";
if ($it['ship_status'] == 1)
{
echo "[已发货]";
}
elseif ($it['ship_status'] == 2)
{
echo "[部分发货]";
}
elseif ($it['ship_status'] == 3)
{
echo "[部分退货]";
}
elseif ($it['ship_status'] == 4)
{
echo "[已退货]";
}
}
$i=$i+1;
}

echo "</td>";
echo "</tr>";

}
echo "</tbody></table>";

echo "<a href='memberorders.php?member_id=$member_id&rowid=$rowid&keyword=$_REQUEST[keyword]'>首页</a> |";
if ($page<=1)
{
echo "上一页 |";
}
else
{
echo "<a href='memberorders.php?member_id=$member_id&rowid=$rowid&keyword=$_REQUEST[keyword]&page=".($page-1)."'>上一页</a> |";
}
if ($page>=$pagenum)
{
echo "下一页 |";
}
else
{
echo "<a href='memberorders.php?member_id=$member_id&rowid=$rowid&keyword=$_REQUEST[keyword]&page=".($page+1)."'>下一页</a> |";
}
echo "<a href='memberorders.php?member_id=$member_id&rowid=$rowid&keyword=$_REQUEST[keyword]&page=".$pagenum."'>尾页</a> ";
echo "当前第".$page."页 | 总".$pagenum."页";




mysql_close($db);


function json_str_iconv($str)
{

if (is_string($str))
{
return ecs_iconv('utf-8', 'gb2312', $str);
}
elseif (is_array($str))
{
foreach ($str as $key => $value)
{
$str[$key] = json_str_iconv($value);
}
return $str;
}
elseif (is_object($str))
{
foreach ($str as $key => $value)
{
$str->$key = json_str_iconv($value);
}
return $str;
}
else
{
return $str;
}

return $str;
}


function ecs_iconv($source_lang, $target_lang, $source_string = '')
{
static $chs = NULL;

/* 址为栈址要转直臃 */
if ($source_lang == $target_lang || $source_string == '' || preg_match("/[\x80-\xFF]+/", $source_string) == 0)
{
return $source_string;
}

if ($chs === NULL)
{
$chs = new Chinese(ROOT_PATH);
}

return $chs->Convert($source_lang, $target_lang, $source_string);
}




?>
</body>
</html>

哎,每次来ecshop都这么死气沉沉,帮忙的就这么少吗



不懂代码真是命苦,其实挺简单的一个功能

我发现EC这里只会说两句。。然后自己解决的!!动一点的话,就是全部懂了。还要问干嘛

这个做起来,挺简单的,也要需要太多的代码,在EC原有用开户中心的订单列表上,改进一下就OK了!

顶起来,我也需要这个东西!

这个功能很简单的,呵呵
可以实现,但要付费,有需要可以联系:280453778

应该有的啊。。

这个功能我也需要哦

很好的,需要

这个功能.不是特别难。我做过了。
有需要联系我把。联系QQ:760868471