Ecshop模板网
ecshop模板制作二次开发插件教程网
共363套模板插件、1920篇文章教程
首页 > ecshop教程 > ecshop经验分享 > 让ecshop用户中心显示用户会员等级
文章详情

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

ecshop模板网 / 2013-12-09

 /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>

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

下一篇: 让ecshop文章列表以更新时间排序 上一篇: 给Ecshop2.7.3商品页加入节省多少元的信息
 用户评论(共 0 条评论)
  • 暂时还没有任何用户评论
用户名: 匿名用户 E-mail:
当前心情:
评论内容:
验证码: captcha
返回顶部 返回首页