我遇到了这个问题,无法解决。部分原因是我无法用正确的术语来解释它。我是新手,很抱歉提出这个笨拙的问题。
下面您可以看到我的目标的概述。
在我的网站中,我有两种类型的帐户 1) 普通买家帐户 2) 卖家账户
当普通买家登录时,它应该重定向“我的仪表板”页面& 对于卖家来说,它应该重定向到“我的订单历史记录”页面。
为此我尝试使用此扩展
http://www.magentocommerce.com/magento-connect/custom-login-redirect.html
但它仅适用于一种类型的用户,例如我在普通买家帐户中提供了卖家的网址,默认显示“您想成为合作伙伴,请联系管理员”
我如何解决我的任务
我使用的是Magento CE1.7
可能是重复的问题抱歉,请原谅我..
有什么想法吗?
最佳答案
您需要创建自己的模块,该模块基本上扩展了 Magento 的基类 Mage_Customer_AccountController
并覆盖 _loginPostRedirect
函数。完整的示例可以在这里找到:
Redirect Customer After Login in Magento
现在,在上述_loginPostRedirect
方法中,您可以使用以下代码获取客户组:
if(Mage::getSingleton('customer/session')->isLoggedIn()){
// Get group Id
$groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
//Get customer Group name
$group = Mage::getModel('customer/group')->load($groupId);
//echo $group->getCode();
// You got the group code, do the redirection
}
以上获取客户群的代码是从Showing which group a customer belongs to in Magento获取的
关于php - 如何为不同类型的用户设置不同的自定义登录重定向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17826345/