ECSHOP商品属性排序按照添加的排序来排序
2016-06-13 13:05 来源:www.chinab4c.com 作者:ecshop专家
ECshop默认商品添加属性排序会出现错乱现象,查了下代码做出以下修复方法打开文件 includes/lib_goods.php 查找以下代码$sql = 'SELECT g.goods_id, g.goods_name, g.goods_thumb, g.goods_img, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ". 'g.market_price, g.promote_price, g.promote_start_date, g.promote_end_date ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods_attr') . ' as a ON g.goods_id = a.goods_id ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ". "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ". "WHERE a.attr_id = '$key' AND g.is_on_sale=1 AND a.attr_value = '$val[value]' AND g.goods_id <> '$_REQUEST[id]' " . 'LIMIT ' . $GLOBALS['_CFG']['attr_related_number']; $res = $GLOBALS['db']->getAll($sql);修改为:$sql = 'SELECT DISTINCT g.goods_id, g.goods_name, g.goods_thumb, g.goods_img, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ". 'g.market_price, g.promote_price, g.promote_start_date, g.promote_end_date ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods_attr') . ' as a ON g.goods_id = a.goods_id ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ". "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ". "WHERE a.attr_id = '$key' AND g.is_on_sale=1 AND a.attr_value = '$val[value]' AND g.goods_id <> '$_REQUEST[id]' " . ' ORDER BY g.goods_id DESC ' . ' LIMIT ' . $GLOBALS['_CFG']['attr_related_number']; $res = $GLOBALS['db']->getAll($sql);
最近更新
常用插件
- ecshop会员中心订单excel倒出
ecshop会员中心订单excel倒出...
- ecshop二次商品订购人信息
ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的...
- ecshop2.7.2退换货申请插件
ecshop2.7.2退换货申请插件,主要是在 ecshop 现在的基础上,对ecshop的订单处...
- ecshop二次开发商品购买备
ecshop销售统计 插件介绍:ecshop二次开发订单销售统计和商品购买备注服...
- ecshop注册推荐送现金插件
ecshop中的促销售功能还不是很完善,随着电子商务系统的发展和进步,...