ecshop详情页显示销量
1.在good.php的最后添加代码
function selled_countgoods($goods_id)
{
$sql= "select sum(goods_number) as count from".$GLOBALS[‘ecs’]->table(‘order_goods’)."where goods_id=’".$goods_id."’";
$res = $GLOBALS[‘db’]->getOne($sql);if($res>0){return $res;}else{return(‘0’);}
}
2.在
$smarty->display(‘goods.dwt’,$cache_id);之前添加代码
$smarty->assign(‘order_num’,selled_countgoods($goods_id));
3.在goods.dwt页面里的调用:{$order_num}
,人生没有彩排,只有现场直播,所以每一件事都要努力做得最好