欢迎来到素材无忧网,按 + 收藏我们
登录 注册 退出 找回密码

ecshop商品详情页面显示商品购买记录方法

时间: 2024-02-25 10:43 阅读: 作者:素材无忧网

实现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中加入 代码
历史购买记录 名字 订单号 地址 数量 日期
{$saleitem.name} {$saleitem.order_sn}
{$saleitem.address} {$saleitem.number} {$saleitem.add_time}

版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!

转载请注明: ecshop商品详情页面显示商品购买记录方法

推荐文章
模板推荐
  • 联系我们

    网站模板素材无忧

    网站模板源码群

    客服QQ

    工作时间:8:00-18:00

    客服QQ

    379144319

    电子邮件

    379144319@qq.com

  • 返回顶部