为了帮助新手 解决列表的购买数量又是如何调用呢

2016-07-07 15:00 来源:www.chinab4c.com 作者:ecshop专家

category.php513行左右加入 这行。记得要把 get_goods_ordernum这个函数放到lib_goods.php
$arr[$row['goods_id']]['order_num'] = get_goods_ordernum($row['goods_id']);


  1. /**获得购买次数*/
  2. function get_goods_ordernum($goods_id)
  3. {
  4. $sql = 'SELECT count(*) ' .
  5. 'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS oi LEFT JOIN ' . $GLOBALS['ecs']->table('users') . ' AS u ON oi.user_id = u.user_id, ' . $GLOBALS['ecs']->table('order_goods') . ' AS og ' .
  6. 'WHERE oi.order_id = og.order_id AND ' . time() . ' - oi.add_time < 2592000 AND og.goods_id = ' . $goods_id;
  7. $count = $GLOBALS['db']->getOne($sql);
  8. return $count;
  9. }
复制代码

回答:
qiyongdong,好久不见了。
一直是共享倡导者,值得钦佩!!!

哦~又见齐老师,你好齐老师!

多谢齐老师!