function getGoodsTotalById($id){
$sql = "SELECT COUNT(*) AS total_order, SUM(g.goods_number) AS total_goods " .
"FROM " . $GLOBALS['ecs']->table('order_info') . " AS o, " .
$GLOBALS['ecs']->table('order_goods') . " AS g " .
" WHERE o.order_id = g.order_id " .
" AND g.goods_id = $id" .
" AND (order_status = '" . OS_CONFIRMED . "' OR order_status = '" . OS_UNCONFIRMED . "' OR order_status = '5')";
$res = $GLOBALS['db']->getRow($sql);
return $res;
}
$goods[$idx]['zhekou_price'] = round(($row['promote_price']/$row['shop_price'])*100)/10+"";//获取商品是几折
$totals=getGoodsTotalById($row['goods_id']);
$goods[$idx]['total_order'] = $totals['total_order'];//某个商品的订单总数,或者是用多少个人购买的这个商品
$goods[$idx]['total_goods'] = $totals['total_goods'];//某个商品的销售总数
- 相关文章
- 查看评论:(0)
【已经有0位大神发现了看法】
- [分享]面试中问到了HTTP状态,把HTTP中常见的状态码再回顾一下 2022-12-05
- [原创]当ZBlogPHP的页面类型为tag和date时,模板中的tag模板标签和date模板标签有哪些 2020-07-20
- [原创]notepad++格式化php代码,美化php代码,phpCodeBeautifier(phpCB.exe) 2017-03-07
- [分享]PHP自定义函数指定参数类型 2016-01-22
- [分享]dedecms 增加项目别名 2016-01-22
- [分享]tar压缩和解压缩用法 2012-09-17
- [分享]新手学习SEO应该具备的54个技巧 2012-03-23
发表评论: