您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop商品详情页面显示商品购买记录方法
水桃2024-01-16 20:24:51ecshop商城教程已有人查阅
导读实现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}
本文标签:
很赞哦! ()
相关文章
随机图文
-
通过AJAX方式动态更新ecshop购物车页面的商品数量的方法
每次用户进入ecshop购物流程的时候当需要更改购物车里的商品数量的时候必须要手动点击更新按钮 -
ecshop自定义导航栏,ecshop导航栏修改方法
ECSHOP自定义导航栏,ECSHOP导航栏修改。ECShop页面上的链接导航,都是可以修改的。 -
ecshop数据库数据表优化使用教程
数据库优化 后台管理—数据库管理—数据表优化点击开始进行数据表优化,即可以进行数据库优化。 -
ecshop商品库存为0商品价格为0显示销售完毕
ecshop通过判断库存和价格来决定是否能购买的语句判断。实现功能:1.判断库存为0则不能点击购买:2.价钱为0则显示为电话询价:
留言与评论 (共有 条评论) |