• 观点

    互联网+时代,说建站,谈运营与网络营销

    ECSHOP商品显示属性价格最低价格到最大价格

    时间:2020-12-21

    ECSHOP获得有规格属性的商品的销售价格范围 实现显示价格区间 

    仿淘宝对有商品属性且属性有附加价格的商品显示为价格区间 首先请看效果截图:


    代码修改:

    1. includes/lib_goods.php 文件中找到function get_goods_info($goods_id)

    在此函数中找到代码:

     

    /* 获得商品的销售价格 */

    $row['market_price']        = price_format($row['market_price']);

    $row['shop_price_formated'] = price_format($row['shop_price']);

     

    然后在此代码下面加上如下一段代码即可实现:

     

    /* 获得有规格属性的商品的销售价格范围 */

    $sql = "SELECT SUM(max_attr_price) AS max_price FROM (SELECT MAX(attr_price+0) AS max_attr_price FROM " . $GLOBALS['ecs']->table('goods_attr') .

    " WHERE goods_id = '".$goods_id."' GROUP BY attr_id) AS a";

    $max_price = $GLOBALS['db']->getOne($sql);

    if(intval($max_price) > 0)

    {

    $goods_max_price = intval($max_price) + intval($row['shop_price']);

    $row['shop_price_formated'] = "".number_format($row['shop_price'], 2)."  ".number_format($goods_max_price, 2)."";

    }

    0
    首页
    案例
    关于
    联系