将客户重定向到客户单击登录Magento的页面
我想将客户重定向到客户单击登录的页面,就像如果客户在任何类别页面上并单击登录,那么在登录之后,他必须重定向到类别页面 我在观测者的将客户重定向到客户单击登录Magento的页面,magento,Magento,我想将客户重定向到客户单击登录的页面,就像如果客户在任何类别页面上并单击登录,那么在登录之后,他必须重定向到类别页面 我在观测者的customer\u login事件中执行此代码,但当尝试在auth url之前获取时,我得到的是customer/account/loginPost,而不是类别url 我使用的代码是: $session = Mage::getSingleton( 'customer/session' ); Mage::getSingleton('customer/session')
customer\u login
事件中执行此代码,但当尝试在auth url之前获取时,我得到的是customer/account/loginPost
,而不是类别url
我使用的代码是:
$session = Mage::getSingleton( 'customer/session' );
Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*'))
但这不会重定向到任何地方,而输出作为
[before_auth_url] => /customer/account/loginPost/
[after_auth_url] =>/customer/account/loginPost/
您可以从管理端对此进行配置。 登录Magento管理端并更改系统配置。
系统>配置>客户配置>登录选项>登录后将客户重定向到帐户仪表板>否
如果选择“否”,客户将停留在当前页面。嗨,朋友,您可以这样做 app/code/core/Mage/Customer/controllers/AccountController.php
//$session->setBeforeAuthUrl($this->_getHelper('customer')->getAccountUrl());
$session->setBeforeAuthUrl(Mage::getBaseUrl().'your_url');
这是我自己弄的,希望能对其他人有所帮助
<controller_action_predispatch_customer_account_login>
<observers>
<ash_getref>
<class>ash_getref/observer_customer</class>
<method>getReferrerUrl</method>
</ash_getref>
</observers>
</controller_action_predispatch_customer_account_login>
customer\u login
<customer_login>
<observers>
<ash_getref>
<class>ash_getref/observer_customer</class>
<method>customerLogin</method>
</ash_getref>
</observers>
</customer_login>
@scrowler的可能复制品看起来更苗条,但情况有所不同。
<customer_login>
<observers>
<ash_getref>
<class>ash_getref/observer_customer</class>
<method>customerLogin</method>
</ash_getref>
</observers>
</customer_login>
public function customerLogin(){
Mage::app()->getResponse()->setRedirect(Mage::getSingleton('core/session')->getReferrerUrl());
Mage::app()->getResponse()->sendResponse();
exit;
}