我正在使用 Magento 1.4.1.1

只有登录的客户才能访问我网站的几个页面。因此,当未登录的客户尝试访问需要他/她登录的页面时,他/她会被重定向到登录页面。使用以下代码。

if(!$this->helper('customer')->isLoggedIn())
{
    Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account'));
}

登录成功后,客户将被重定向到他/她的帐户面板(之前的页面位置丢失)。

有什么办法让magento在登录成功后返回到客户所在的页面吗?

问候

有帮助吗?

解决方案

您可以将其添加到客户的页面必须登录: Mage :: GetModel('客户/会话') - > setBeforeAuthurl([页面的链接])

其他提示

系统->配置->客户配置->登录选项 并设置值 Redirect Customer to Account Dashboard after Logging inNo.

有(至少)两个选项可在客户登录后控制重定向目标:

  1. 在客户会话中设置after_auth_url属性。
  2. 与上述由Marius 添加到LoginPost请求的referer请求参数。
  3. 请参阅 Mage_Customer_AccountController::_loginPostRedirect()

并尝试将其放在Controls文件“应用程序/代码/本地/法师/客户/控制器/ ConsuberController.php中”loginpostaction“之前”if($ this-> getRequest() - > ispost()){“

许可以下: CC-BY-SA归因
scroll top