zoukankan      html  css  js  c++  java
  • 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);


    这样就可以了。

  • 相关阅读:
    洛谷P3258 [JLOI2014]松鼠的新家
    洛谷P3128 [USACO15DEC]最大流Max Flow
    Bzoj1651: [Usaco2006 Feb]Stall Reservations 专用牛棚
    2017-9-26 NOIP模拟赛
    洛谷P1441 砝码称重
    洛谷P1275 魔板
    洛谷P2037 电话号码
    2014-11-3 NOIP模拟赛2
    洛谷P3102 [USACO14FEB]秘密代码Secret Code
    洛谷P3070 [USACO13JAN]岛游记Island Travels
  • 原文地址:https://www.cnblogs.com/wangblognet/p/2826166.html
Copyright © 2011-2022 走看看