打开goods.php
找到$smarty->display('goods.dwt', $cache_id);
下面添加
//获得订单数量
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了。即可以调用购买数量了。
新闻热点
疑难解答