您现在的位置是:首页 > 教程 > 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订单一键发货简化订单发货流程
步骤一:在templates/order_info.htm文件找到:在此代码前加上“一键发货”按钮,代码如下:在此代码下添加发货操作代码,代码如下 -
ecshop商品页详情怎么显示商品累计销售数量
在ecshop商品详情页如果能显示销量,无疑会一定程度上影响用户的购买机会。特别如果显示有非常好的销量及直观数字,相信会极大的 购买欲,提高转化率。 -
ecshop订单状态数据表字段说明
order_info 表刚下完订单order_status 0shipping_status 0pay_status 0取消order_status 2shipping_status 0pay_status 0 -
ecshop首页调用指定商品分类的推荐、热卖、新品商品
大家都知道ECSHOP首页的推荐、热卖和新品三个板块的商品都是从所有商品里读取出来的。如果我想“在ecshop首页调用指定分类的推荐、热卖和新品?”
留言与评论 (共有 条评论) |