您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop商品详情页面显示商品购买记录方法
水桃2024-01-16 20:24:51ecshop商城教程已有7人查阅
导读实现ECSHOP商品详情页面显示购买记录有些ECSHOP模板开发时候没有带这个商品购买记录,所以需要自己增加下:
实现ECSHOP商品详情页面显示购买记录有些ECSHOP模板开发时候没有带这个商品购买记录,所以需要自己增加下:
在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=" " cellpadding="5" cellspacing="1"> 历史购买记录 名字 订单号 地址 数量 日期
{$saleitem.name} {$saleitem.order_sn} <td align="center">{$saleitem.address} <td align="center">{$saleitem.number} <td align="center">{$saleitem.add_time}
在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=" " cellpadding="5" cellspacing="1"> 历史购买记录 名字 订单号 地址 数量 日期
{$saleitem.name} {$saleitem.order_sn} <td align="center">{$saleitem.address} <td align="center">{$saleitem.number} <td align="center">{$saleitem.add_time}
本文标签:
很赞哦! (0)
暂无内容 |
暂无内容 |
相关文章
暂无内容 |
暂无内容 |
随机图文
ecshop后台订单详情显示商品缩略图及订单打印页显示商品缩略图
有时我们希望在ECSHOP后台订单详情中显示商品缩略图,以及订单打印页显示商品缩略图,如下图:实现方法: 步:打开 admin/order.php 文件查整理简单的统一CSS命名规则
class和id的值在HTML和XHTML中也是区分大小写的,如果你一定要大小写混合写,请仔细确认你在CSS的定义和XHTML里的标签是一致的。ecshop怎么与discuz整合
最近在做一个电子商务网站,需要在上面挂一个论坛,discuz无疑是最佳的选择,自然就得需要实现ecshop与discuz的同步登陆,否则空挂一个论坛在上面毫无意义。ecshop数据库getRow、getAll、getOne之间的区别
ECShop没有使用一些开源的数据库操作类,比如adodb或者PEAR,而是封装了自己的实现。这样做的好处是实现非常轻量,大大减小了分发包的文件大小。
留言与评论 (共有 0 条评论) |