Magento:自定义登录重定向为特定的客户组

Magento: custom login redirect for specific customer group

本文关键字:客户 自定义 登录 重定向 Magento      更新时间:2023-09-26

我有一个自定义登录,它应该将特定的客户组重定向到特定的页面。我使用以下代码的形式,但我不知道我应该在哪里做检查组id:

<?php
 $login_url  = 'http://specific-url/';
 $http_mode  = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on');
 if($http_mode)
  $login_url  = str_replace('http:', 'https:', $login_url);  
 ?>
  <form method="post" id="login-form" action="<?php echo $login_url ?>">
 <div class='full'>
            <label>
                <?php echo $this->__('Email Address') ?>
            </label>
            <sup>*</sup>
            <div class="data_area">
                <input type="text" name="login[username]" value="<?php echo $this-        
  >htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry     
   validate-email" title="<?php echo $this->__('Email Address') ?>" />
            </div>
        </div>
    <div class='full'>
            <label>
                <?php echo $this->__('Password') ?>
            </label>
            <sup>*</sup>
            <div class="input-box">
                <input type="password" name="login[password]" class="input-text 
       required-entry validate-password" id="pass" title="<?php echo $this-  
      >__('Password') ?>" />
            </div>
        </div>
     <button type="submit" class="button" title="<?php echo $this->__('Login') ?>"    
     name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span> 
     </button>
     <script type="text/javascript">
    //<![CDATA[
    var loginForm = new VarienForm('login-form', true);
     //]]>
     </script>

我的建议是,当您提交表单时,将使用数据库验证电子邮件id和密码,验证成功后,用户将被重定向到user Home Page。因此,在重定向到主页之前,检查用户的用户组,并发送一个自定义重定向到另一个页面。
我希望它能起作用。