您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop商品属性排序按照添加的排序来排序
怜云2024-01-16 21:31:01ecshop商城教程已有人查阅
导读ECshop默认商品添加属 排序会出现错乱现象,查了下代码做出以下修改打开文件 includes/lib_goods.php
ECshop默认商品添加属 排序会出现错乱现象,查了下代码做出以下修改
打开文件 includes/lib_goods.php
查找以下代码
打开文件 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商品类型添加编辑方法
各位ECSHOP网店系统用户大家好,欢迎来到ECSHOP教程网图文教程,今天为大家详细解说一下ECSHOP商品类型,ECSHOP商品属 设置。 ECSHO -
ecshop openssl IIS开启方法
ecshop IIS开启openssl方法以下就是Windows 2003 + IIS 下,如何在PHP扩展里打开openssl支持的方法: -
ecshop用户商品评论功能介绍
此页面列出很新的用户评论信息,包括用户名,评论的类型,评论的对象,发表的时间等等。评论内容可以按字段一排序,点击相应的字段便可以。 -
ecshop商城Ajax使用方法实例
cshop中的ajax非常好用,当自己 次使用的时候,也非常吃力。当自己用多了的时候,却感觉十分简单,也特别方便。
留言与评论 (共有 条评论) |