Ecshop模板网
首页 > ecshop扩展插件 > ecshop高级别看低级别价格
模板详情
ecshop模板堂
 
ecshop高级别看低级别价格
 
 

ecshop高级别看低级别价格

 
¥300元 
版本

总价 :
 

根据ecshop登录会员的会员等级查看商品详细页里面会员等级价格,高等级的会员可以看到低等级会员的等级价格,二低等级会员则看不到高等级会员价格,方便用户体验!

ecshop高级别看低级别价格

ecshop高级别看低级别价格

ecshop高级别看低级别价格

 

 安装方法:

1、找到根目录下的goods.php文件,打开在其底部加上以下代码:

 

 

 

//*****查找设定的用户会员等级最大积分

function get_fine_user_rank($user_points,$max_points_level){

       $sql = "sel ect ur.rank_id, ur.rank_name, ur.min_points, ur.max_points from ".$GLOBALS['ecs']->table('user_rank')." as ur where ur.min_points <= '$user_points' and ur.max_points >= '$user_points'";

       $res = $GLOBALS['db']->getAll($sql);

      

       foreach($res as $row){

              $arr['rank_id'] = $row['rank_id'];

              $arr['rank_name'] = $row['rank_name'];

              $arr['max_points'] = $row['max_points'];

              if($row['max_points'] >= $max_points_level){

                     $arr['max_points_level'] = 1;

              }else{

                     $arr['max_points_level'] = 0;

              }

       }

      

       return $arr;

}

 

//*****查找会员用户积分

function get_fine_user_points($user_id){

       $sql = "sel ect u.rank_points from ".$GLOBALS['ecs']->table('users')."  as u where u.user_id = '$user_id'";

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

      

       return $res;

}

 

 

 

2、继续往下查找,找到function get_user_rank_prices($goods_id, $shop_price) 函数,如图:

复制以下代码,将此函数覆盖:

 

function get_user_rank_prices($goods_id, $shop_price)

{

    $sql = "SELECT rank_id,max_points, INULLmp.user_price, r.discount * $shop_price / 100) AS price, r.rank_name, r.discount " .

            'FROM ' . $GLOBALS['ecs']->table('user_rank') . ' AS r ' .

            'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . " AS mp ".

                "ON mp.goods_id = '$goods_id' AND mp.user_rank = r.rank_id " .

            "WHERE r.show_price = 1 OR r.rank_id = '$_SESSION[user_rank]'";

    $res = $GLOBALS['db']->getAll($sql);

      

       $user_points = get_fine_user_points($_SESSION['user_id']); //

    $arr = array();

    foreach($res as $row)

    {

             

        $arr[$row['rank_id']]['rank_name'] = htmlspecialchars($row['rank_name']);

              $arr[$row['rank_id']]['max_points'] = $row['max_points'];

              $user_rank = get_fine_user_rank($user_points,$row['max_points']);                

              $arr[$row['rank_id']]['user_rank_maxPoints'] = $user_rank['max_points_level'];    //

        $arr[$row['rank_id']]['price']     = price_format($row['price']);

    }

      

    return $arr;

}

 

 

3、继续往下查找,找到$tag_array = get_tags($goods_id);代码位置

 

 

在其上面加上以下代码:


              if(empty($_SESSION['user_id'])){

                     $userId = 0;

              }else{

                     $userId = 1;

              }

              $smarty->assign('userId',          $userId);   //判断会员是否登录

             

 

 

4、找到根目录下themes\default目录中找到goods.dwt文件,打开查找以下代码:

<!-- {foreach from=$rank_prices item=rank_price key=key} 会员等级对应的价格-->
       <strong>{$rank_price.rank_name}:</strong><font class="shop" id="ECS_RANKPRICE_{$key}">{$rank_price.price}</font><br />
       <!--{/foreach}-->

将以下代码将其覆盖:

<!-- {foreach from=$rank_prices item=rank_price key=key} 会员等级对应的价格-->

               

       {if $rank_price.user_rank_maxPoints eq 1}<strong>{$rank_price.rank_name}:</strong><font class="shop" id="ECS_RANKPRICE_{$key}">{$rank_price.price}</font><br />{/if}

              

       <!--{/foreach}-->

   

       {if $userId eq 0}<strong class="shop">登陆才能看到会员优惠价格</strong>{/if}

    

 

 

如安装有问题,您可以在安装步骤目录打开文件搜索   进行对比修改

 

 

注释:后台需要注意的地方

比如VIP的积分下限要比注册用户的积分上限要至少大一个值,并且特殊会员组不能打钩

 

 


 用户评论(共 0 条评论)
  • 暂时还没有任何用户评论
用户名: 匿名用户 E-mail:
当前心情:
评论内容:
验证码: captcha
返回顶部 返回首页
 
QQ在线咨询
售前电话热线
#
售前QQ客服