打開goods.php
找到$smarty->display('goods.dwt', $cache_id);
下面添加
//獲得訂單數(shù)量
function selled_count($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');
}
}
找到$smarty->assign('now_time', gmtime());
上面添加
$smarty->assign('order_num',selled_count($goods_id));
然后打開goods.dwt
{$order_num} 進行添加即可。
這樣就OK了。即可以調(diào)用購買數(shù)量了。
新聞熱點
疑難解答
圖片精選