ECShop修改商品的近期购买记录显示所有

  • PHP二次开发
  • 2015-3-14 21:35
  • PHP二次开发网
  • 阅读(4432)
  • 评论(0)
  • 摘要: 直接上修改方法,找到文件:includes/lib_insert.php找到这句话:php代码:$sql = 'SELECT u.user_name, og.goods_number, oi.add_time, IF(oi.order_status IN (2, 3, 4), 0, 1) AS order_status ' . 'FROM ' . $GL ...
    直接上修改方法,找到文件:includes/lib_insert.php

    找到这句话:

    [代码]php代码:

    $sql = 'SELECT u.user_name, og.goods_number, oi.add_time, IF(oi.order_status IN (2, 3, 4), 0, 1) AS order_status ' .
               '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 ' .
               'WHERE oi.order_id = og.order_id AND ' . time() . ' - oi.add_time < 5592000 AND og.goods_id = ' . $arr['id'] . ' ORDER BY oi.add_time DESC LIMIT 50';
        $bought_notes = $GLOBALS['db']->getAll($sql);
    

    将其修改为:

    [代码]php代码:

    $sql = 'SELECT u.user_name, og.goods_number, oi.add_time, IF(oi.order_status IN (2, 3, 4), 0, 1) AS order_status ' .
               '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 ' .
               'WHERE oi.order_id = og.order_id AND og.goods_id = ' . $arr['id'] . ' ORDER BY oi.add_time DESC LIMIT 50';
        $bought_notes = $GLOBALS['db']->getAll($sql);

    再找到下面这句:

    [代码]php代码:

    $sql = 'SELECT count(*) ' .
               '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 ' .
               'WHERE oi.order_id = og.order_id AND ' . time() . ' - oi.add_time < 5592000 AND og.goods_id = ' . $arr['id'];
        $count = $GLOBALS['db']->getOne($sql);

    将其修改为:

    [代码]php代码:

    $sql = 'SELECT count(*) ' .
               '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 ' .
               'WHERE oi.order_id = og.order_id AND og.goods_id = ' . $arr['id'];
        $count = $GLOBALS['db']->getOne($sql);

    找到文件:includes/goods.php

    找到这段话:

    [代码]php代码:

    $sql = 'SELECT u.user_name, og.goods_number, oi.add_time, IF(oi.order_status IN (2, 3, 4), 0, 1) AS order_status ' .
                   '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 ' .
                   '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) * 50 . ',50';

    将其修改为:

    [代码]php代码:

    $sql = 'SELECT u.user_name, og.goods_number, oi.add_time, IF(oi.order_status IN (2, 3, 4), 0, 1) AS order_status ' .
                   '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 ' .
                   'WHERE oi.order_id = og.order_id AND og.goods_id = ' . $goods_id . ' ORDER BY oi.add_time DESC LIMIT ' . (($page > 1) ? ($page-1) : 0) * 50 . ',50';

    再往下找到这段:

    [代码]php代码:

    $sql = 'SELECT count(*) ' .
                   '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 ' .
                   'WHERE oi.order_id = og.order_id AND ' . time() . ' - oi.add_time < 2592000 AND og.goods_id = ' . $goods_id;

    将其修改为:

    [代码]php代码:

    $sql = 'SELECT count(*) ' .
                   '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 ' .
                   'WHERE oi.order_id = og.order_id AND og.goods_id = ' . $goods_id;

    最后更新缓存即可。



    PHP技术交流QQ群:422137578

    除非注明,文章均为 PHP二次开发 原创,转载请注明本文地址:http://www.php2.cc/article-1786-1.html

    相关阅读

    最新评论

    用户名:  *

    邮 箱:  *

    网 址: 注意加上“http://”哦!