1. Write the code in goods.php:
//History of Purchasefunction 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. In about 240 lines to insert:
$smarty->assign ('sale_history', getsales_history ($goods _id)); // Get purchase history
3. Write on the GOODS.DWT page:
<table width="100%"cellpadding="5"cellspacing="1"> <tr> <th> Historical purchase history </th> <th> name </th> <th> Order number </th><th> product name </th> <th> address </th> & Lt;th> quantity </th> <th> date </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 Item Details page displays purchase history