zoukankan      html  css  js  c++  java
  • ECSHOP 版本2.7 商品详情页面,显示购买记录

    EC版本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> 
  • 相关阅读:
    剑指offer 数值的整数次方
    剑指offer 链表中倒数第K个节点
    剑指offer反转链表
    剑指offer 栈的压入弹出 顺序
    剑指offer 二叉搜索树后续遍历序列 判断
    剑指offer 复杂链表的复制 (有向图的复制)
    剑指offer 二叉搜索树与双向链表
    2018/03/15 常用的超全局变量
    2018/03/14 每日一个Linux命令 之 ln
    PHP使用 zip 扩展压缩文件
  • 原文地址:https://www.cnblogs.com/wangblognet/p/2821812.html
Copyright © 2011-2022 走看看