在线建站培训
您的位置: 魔客吧 cms教程 ecshop教程 查看内容

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

2017-6-25 08:17 | 发布者: moke | 栏目:ecshop教程

直接上修改方法,找到文件: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;

最后更新缓存即可。





魔客吧温馨提示:如果你正在寻找优秀的ecshop模板,那你可以到魔客吧的 ecshop模板 频道看看,相信一定有你喜欢的!

最新分享资源

最新评论

验证码 换一个