ECSHOP开发中心()讲一下如何调用ecshop商品详情页的购买数量。
打开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} 在需要的地方加
,所有的胜利,与征服自己的胜利比起来,都是微不足道