zoukankan      html  css  js  c++  java
  • ECSHOP实现首页读取会员等级和价格

    实现在首页读取会员等级和价格的方法


    1:在   includes/lib_goods.php 中       查找

    {
    
    $type_array[$key] = array();
    
    }
    
    }
    
    }

    用下面的代码替换

    /**
    
    * 获得商品的详细信息
    *
    * @access public
    * @param integer $goods_id
    * @return void
    */
    
    if( $_SESSION[user_rank] == 0 ){
    
    
    $user_rank=6;
    
    
    }
    
     
    
    else{
    
    $user_rank = $_SESSION[user_rank] ;
    
    }
    
     
    
    //取出所有符合条件的商品数据,并将结果存入对应的推荐类型数组中
    
    $sql = ‘SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, g.give_integral,mp.user_rank as userrank,r.rank_name,
    
    r.discount, IFNULL(mp.user_price, r.discount*g.shop_price/100) AS rank_price,’ .
    
    “IFNULL(mp.user_price, g.shop_price * ‘$_SESSION[discount]‘) AS shop_price, “.
    
    “promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd ” .
    
    ‘FROM ‘ . $GLOBALS['ecs']->table(’goods’) . ‘ AS g ‘ .
    
    “LEFT JOIN ” . $GLOBALS['ecs']->table(’member_price’) . ” AS mp “.
    
    “ON mp.goods_id = g.goods_id AND mp.user_rank = ‘$user_rank’ “.
    
    “LEFT JOIN ” . $GLOBALS['ecs']->table(’user_rank’) . ” AS r “.
    
    “ON r.rank_id = $user_rank”;
    
    $type_merge = array_merge($type_array['new'], $type_array['best'], $type_array['hot']);
    
    $type_merge = array_unique($type_merge);
    
    $sql .= ‘ WHERE g.goods_id ‘ . db_create_in($type_merge);
    
    $sql .= ‘ ORDER BY g.sort_order, g.last_update DESC’;
    
    $result = $GLOBALS['db']->getAll($sql);
    
    foreach ($result AS $idx => $row)
    
    {
    
    if ($row['promote_price'] > 0)
    
    {
    
    $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
    
    $goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : ”;
    
    }
    
    else
    
    {
    
    $goods[$idx]['promote_price'] = ”;
    
    }
    
    $goods[$idx]['id'] = $row['goods_id'];
    
    $goods[$idx]['name'] = $row['goods_name'];
    
    $goods[$idx]['rank_name'] = $row['rank_name'];
    
    $goods[$idx]['discount'] = $row['discount'];
    
    $goods[$idx]['brief'] = $row['goods_brief'];
    
    $goods[$idx]['brand_name'] = isset($goods_data['brand'][$row['goods_id']]) ? $goods_data['brand'][$row['goods_id']] : ”;
    
    $goods[$idx]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);
    
    $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ?
    
    sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
    
    $goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'],$row['goods_name_style']);
    
    $goods[$idx]['market_price'] = price_format($row['market_price']);
    
    $goods[$idx]['shop_price'] = price_format($row['shop_price']);
    
    $goods[$idx]['rank_price'] = price_format($row['rank_price']);
    
    $goods[$idx]['give_integral'] = $row['give_integral'];
    
    $goods[$idx]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
    
    $goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
    
    $goods[$idx]['url'] = build_uri(’goods’, array(’gid’ => $row['goods_id']), $row['goods_name']);
    
     
    
     
    
    if (in_array($row['goods_id'], $type_array['best']))
    
    {
    
    $type_goods['best'][] = $goods[$idx];
    
    }
    
    if (in_array($row['goods_id'], $type_array['new']))
    
    {
    
    $type_goods['new'][] = $goods[$idx];
    
    }
    
    if (in_array($row['goods_id'], $type_array['hot']))
    
    {
    
    $type_goods['hot'][] = $goods[$idx];
    
    }
    
    }
    
    }
    
    return $type_goods[$type];
    
     
    
    }

    2:在首页要调用的库文件中 (如: recommend_best.lbi)

    找到


    <!– {if $show_marketprice} –>

    {$lang.market_price}<span>{$goods.market_price}</span><br />

    <!– {/if} –>

    下面添加

    {$goods.rank_name}{$goods.rank_price} <br>

    这样,在没有登陆的时候显示 普通会员价,登陆之后就显示会员对应的等级和价格。

  • 相关阅读:
    EBS SQL > Form & Report
    oracle sql 优化分析点
    MRP 物料需求计划
    MRPII 制造资源计划
    Barcode128 应用实务
    Oracle SQL语句优化技术分析
    APPSQLAP10710 Online accounting could not be created. AP Invoice 无法创建会计分录
    Oracle数据完整性和锁机制
    ORACLE Responsibility Menu Reference to Other User
    EBS 常用 SQL
  • 原文地址:https://www.cnblogs.com/wangblognet/p/2809908.html
Copyright © 2011-2022 走看看