我遇到了无法解决的问题。部分是因为我无法用正确的术语来解释它。我很陌生,对这个笨拙的问题感到抱歉。
您可以在下面看到我的目标概述。
在我的网站中,我有两种类型的帐户1)普通买家帐户 2)卖家账户
当普通买家登录时,它应该重定向我的DashBoard页面& 对于卖方,它应该重定向到我的订单历史页面。
为此我尝试使用此扩展程序
http://www.magentocommerce.com/magento-connect/custom-login-redirect.html
但它只适用于一种类型的用户,例如我在普通买家帐户中为卖家提供了网址,默认显示"您想成为合作伙伴请联系管理员"
我如何解决我的任务
我正在使用Magento CE1.7
可能是一个重复的问题抱歉只是原谅我..
有什么想法吗?
答案 0 :(得分:1)
您需要创建自己的模块,该模块基本上扩展了Magento的基类Mage_Customer_AccountController
并覆盖了_loginPostRedirect
函数。这里有一个完整的例子:
Redirect Customer After Login in Magento
现在在_loginPostRedirect
的上述方法中,您可以使用以下代码获取Customer组:
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
获取的