关于让ecshop用户中心显示用户会员等级

2016-09-11 20:39 来源:www.chinab4c.com 作者:ecshop专家

 /includes/lib_clips.php文件中搜索如下代码

$sql = "SELECT pay_points, user_money, credit_line, last_login, is_validated FROM " .$GLOBALS['ecs']->table('users'). " WHERE user_id = '$user_id'";

改成

$sql = "SELECT pay_points, user_money, user_rank, credit_line, last_login, is_validated FROM " .$GLOBALS['ecs']->table('users'). " WHERE user_id = '$user_id'";

然后在后面继续插入代码

if($row['user_rank']=='0') {
  
      $sql2 = "SELECT b.rank_name as userrank FROM ". $GLOBALS['ecs']->table('users') ." as a,".$GLOBALS['ecs']->table('user_rank')." as b WHERE a.rank_points > b.min_points AND a.rank_points < b.max_points AND a.user_id = '$user_id'";
  
   }else {
  
     $user_rank = $row['user_rank'];
  
      $sql2 = "SELECT b.rank_name as userrank FROM ". $GLOBALS['ecs']->table('users') ." as a,".$GLOBALS['ecs']->table('user_rank')." as b WHERE a.user_rank = b.rank_id AND a.user_id = '$user_id'";
  
   }
  
   $row2 = $GLOBALS['db']->getRow($sql2);

再找到下面代码

$info = array();
$info['username']   = $_SESSION['user_name'];
$info['shop_name'] = $GLOBALS['_CFG']['shop_name'];
$info['integral']   = $row['pay_points'] . $GLOBALS['_CFG']['integral_name'];

下面插入 

if ($row2['userrank'] != null){
$info['userrank'] = $row2['userrank'];}
else {
$info['userrank'] = "普通会员";
  
}

/themes/当前模板/user_clips.dwt写入相应位置加入:

<font class="f1">您的会员级别为:<strong>{$info.userrank}</strong> {$rank_name} {$next_rank_name}</font>

 更新缓存,刷新用户中心,就能看到效果了,我这边就不贴图了。