【发布时间】:2016-03-04 23:22:58
【问题描述】:
整个网站都有“注销”链接。如果我们点击注销,它会重定向到这个页面。
http://sitename/customer/account/logoutSuccess/
但在某些 phtml 页面中,例如,在下面的页面中
http://sitename.com/marketplace/marketplaceaccount/myproductslist/
如果我们点击“注销”,它应该注销但重定向到以下网址:
http://sitename.com/marketplace.
在谷歌我发现重定向整个网站。但我只需要一些页面。
我正在使用以下代码:Accountcontroller.php
require_once 'Mage/Customer/controllers/AccountController.php';
class Webkul_Marketplace_AccountController extends Mage_Customer_AccountController{
public function marketlogoutAction()
{
$this->_getSession()->logout()
->renewSession();
//add your code here
$this->_redirect('marketplace');
echo "something";
exit();
}
public function logoutAction()
{
$this->_getSession()->logout()
->renewSession();
$this->_redirect('*/*/logoutSuccess');
}
Data.php [app/code/local/Mage/Customer/Helper]
public function getLogoutUrl()
{
$currentUrl = Mage::helper('core/url')->getCurrentUrl();
if (strpos($currentUrl,'marketplaceaccount') !== false) {
return $this->_getUrl('marketplace');
}else
{
return $this->_getUrl('customer/account/logout');
}
}
但是当我从一些 phtml 页面注销时,它会重定向到我需要的页面,但它没有注销。
【问题讨论】: