ECSHOP 版本2.7 商品详情页面,显示购买记录
时间:2024年01月31日
/来源:网络
/编辑:佚名
ecshop版本2.7
在goods.php加入 代码
复制代码
$smarty->assign('sale_history', getsales_history($goods_id)); //获取购买历史记录
function getsales_history($goods_id){
$sql ='select f.consignee, f.order_sn, f.address, g.goods_number,f.add_time FROM '. $GLOBALS['ecs']->table('order_goods') .' as g,'. $GLOBALS['ecs']->table('order_info') .' as f where g.order_id = f.order_id and g.goods_id='.$goods_id;
$res = $GLOBALS['db']->getAll($sql);
$sales_history = array();
foreach ($res AS $idx => $row){
$sales_history[$idx]['name'] = $row['consignee'];
$sales_history[$idx]['order_sn'] = $row['order_sn'];
$sales_history[$idx]['address'] = $row['address'];
$sales_history[$idx]['number'] = $row['goods_number'];
// $sales_history[$idx]['add_time'] = local_date("Y-m-d", $row['add_time']);
$sales_history[$idx]['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']);
}
return $sales_history;
}
复制代码
在goods.dwt中加入 代码
复制代码
<table width="100%" cellpadding="5" cellspacing="1">
<tr>
<th>历史购买记录</th>
<th>名字</th>
<th>订单号</th>
<th>地址</th>
<th>数量</th>
<th>日期</th>
</tr>
<!--{foreach from=$sale_history item=saleitem}-->
<tr>
<td></td>
<td>{$saleitem.name}</td>
<td>{$saleitem.order_sn}</td>
<td align="center">{$saleitem.address}</td>
<td align="center">{$saleitem.number}</td>
<td align="center">{$saleitem.add_time}</td>
</tr>
<!--{/foreach}-->
</table>
复制代码
在goods.php加入 代码
复制代码
$smarty->assign('sale_history', getsales_history($goods_id)); //获取购买历史记录
function getsales_history($goods_id){
$sql ='select f.consignee, f.order_sn, f.address, g.goods_number,f.add_time FROM '. $GLOBALS['ecs']->table('order_goods') .' as g,'. $GLOBALS['ecs']->table('order_info') .' as f where g.order_id = f.order_id and g.goods_id='.$goods_id;
$res = $GLOBALS['db']->getAll($sql);
$sales_history = array();
foreach ($res AS $idx => $row){
$sales_history[$idx]['name'] = $row['consignee'];
$sales_history[$idx]['order_sn'] = $row['order_sn'];
$sales_history[$idx]['address'] = $row['address'];
$sales_history[$idx]['number'] = $row['goods_number'];
// $sales_history[$idx]['add_time'] = local_date("Y-m-d", $row['add_time']);
$sales_history[$idx]['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']);
}
return $sales_history;
}
复制代码
在goods.dwt中加入 代码
复制代码
<table width="100%" cellpadding="5" cellspacing="1">
<tr>
<th>历史购买记录</th>
<th>名字</th>
<th>订单号</th>
<th>地址</th>
<th>数量</th>
<th>日期</th>
</tr>
<!--{foreach from=$sale_history item=saleitem}-->
<tr>
<td></td>
<td>{$saleitem.name}</td>
<td>{$saleitem.order_sn}</td>
<td align="center">{$saleitem.address}</td>
<td align="center">{$saleitem.number}</td>
<td align="center">{$saleitem.add_time}</td>
</tr>
<!--{/foreach}-->
</table>
复制代码
新闻资讯 更多
热门文章
- 178Moban源码谈谈免费源码与收费源码的区别
- 2帝国CMS忘记后台登陆用户名、密码、认证码的解决方法
- 3帝国CMS(EmpireCMS) v7.5后台任意代码执行漏洞及具体修复方法
- 4帝国CMS和WordPress 哪个好?哪个适合建站?
- 5如何解决Discuz的密码错误次数过多请15分钟后登陆的问题
- 6帝国cms灵动标签取得内容和栏目链接地址
- 7emlog pro 注册码“开心”教程(如果有一天,emlog官方版 或者 emlog免费版 跑路了,那用户怎么办?)
- 8织梦CMS在nginx下设置伪静态方法(附nginx伪静态规则)
- 9帝国cms后台登录出现”您还未登录”怎么解决?
- 10帝国cms7.5忘记登录密码 和忘记登录认证码以及多次登录 失败被锁定解决办法