ecshop商品詳情頁面顯示購買記錄

來源:互聯網
上載者:User

標籤:

1.在goods.php中寫入代碼:

//購買的記錄function getsales_history($goods_id){$sql =‘select f.consignee, f.order_sn, f.address,g.goods_name,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][‘goods_name‘]       = $row[‘goods_name‘];  // $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;}


2.在大概240行作於插入:

$smarty->assign(‘sale_history‘,      getsales_history($goods_id));        //擷取購買記錄


3.在goods.dwt頁面寫上:

<table width="100%" cellpadding="5" cellspacing="1">             <tr>                 <th>曆史購買記錄</th>                 <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>{$saleitem.goods_name}</td>                    <td align="center">{$saleitem.address}</td>                    <td align="center">{$saleitem.number}</td>                    <td align="center">{$saleitem.add_time}</td>                </tr>                <!--{/foreach}-->            </table>

 



ecshop商品詳情頁面顯示購買記錄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.