2013-08-08 2 views
0

Я работаю над кнопкой выхода из magento. Теперь, когда я нажимаю кнопку выхода из системы, она собирается выйти из страницы и перенаправить на текущую страницу.Чтобы перенаправить страницу на текущий, а не на страницу выхода

В шаблоне страницы выхода из системы

<div class="page-head"> 
    <h3><?php echo $this->__("You're now Logged Out") ?></h3> 
</div> 
<p><?php echo $this->__('You have been successfully logged out and will be redirected to our homepage in 5 seconds.') ?></p> 
<script type="text/javascript"> 
setTimeout(function(){ location.href = '<?php echo $this->getUrl() ?>'},5000); 
</script> 

и в customer.xml я нашел

<reference name="root"> 
    <action method="setTemplate"><template>page/1column.phtml</template></action> 
</reference> 
<reference name="content"> 
    <block type="core/template" name="customer_logout" template="customer/logout.phtml"/> 
</reference> 

Теперь я хочу, чтобы перенаправить страницу в прямой c вместо текущей страницы. Надеюсь, вы понимаете и помогаете мне.

ответ

0

Вы взглянули на существующий код Magento, который обрабатывает выход из системы?

Класс Mage_Customer_AccountController

/** 
* Customer logout action 
*/ 
public function logoutAction() 
{ 
    $this->_getSession()->logout() 
     ->setBeforeAuthUrl(Mage::getUrl()); 

    $this->_redirect('*/*/logoutSuccess'); 
} 

Смотрите "setBeforeAuthUrl) (" функцию? Попробуйте играть с ним, чтобы ввести ваш текущий URL, который вы можете получить с: Mage::helper('core/url')->getCurrentUrl();

0

Вы можете попробовать изменить

<script type="text/javascript"> 
setTimeout(function(){ location.href = '<?php echo $this->getUrl() ?>'},5000); 
</script> 

в

<script type="text/javascript"> 
setTimeout(function(){ location.href = document.referrer},5000); 
</script> 
Смежные вопросы