我想让商品购买记录显示已经付款的 请高手帮忙

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

在goods.php文件里找到了相关代码 但是不知道怎么改 请高手帮忙!!

  1. /* 商品购买记录 */
  2. $sql = 'SELECT u.user_name, og.goods_number, oi.add_time, IF(oi.order_status IN (2, 3, 4), 0, 1) AS order_status ' .
  3. 'FROM ' . $ecs->table('order_info') . ' AS oi LEFT JOIN ' . $ecs->table('users') . ' AS u ON oi.user_id = u.user_id, ' . $ecs->table('order_goods') . ' AS og ' .
  4. 'WHERE oi.order_id = og.order_id AND ' . time() . ' - oi.add_time < 2592000 AND og.goods_id = ' . $goods_id . ' ORDER BY oi.add_time DESC LIMIT ' . (($page > 1) ? ($page-1) : 0) * 5 . ',5';
  5. $bought_notes = $db->getAll($sql);

  6. foreach ($bought_notes as $key => $val)
  7. {
  8. $bought_notes[$key]['add_time'] = local_date("Y-m-d G:i:s", $val['add_time']);
  9. }

  10. $sql = 'SELECT count(*) ' .
  11. 'FROM ' . $ecs->table('order_info') . ' AS oi LEFT JOIN ' . $ecs->table('users') . ' AS u ON oi.user_id = u.user_id, ' . $ecs->table('order_goods') . ' AS og ' .
  12. 'WHERE oi.order_id = og.order_id AND ' . time() . ' - oi.add_time < 2592000 AND og.goods_id = ' . $goods_id;
  13. $count = $db->getOne($sql);
复制代码

回答:

这个改动比较大

订单状态是这个就可以
AND order_status IN ('1','5','6') AND shipping_status IN ('0','3','5') AND ( pay_status IN ('2','1') OR pay_id IN ('3') )