magento登錄之後返回登錄之前頁面

在header.phtml或者head.phtml或者controllers文件中添加如下代碼

<?php

if (!Mage::getSingleton("customer/session")->isLoggedIn() && strpos(Mage::getBlockSingleton('page/html')->getBodyClass(),'checkout'))  
{  
        $session = Mage::getSingleton("customer/session");  
        // Store The Current Page Url Where User will be redirected once loggedin  
        $session->setBeforeAuthUrl(Mage::helper("core/url")->getCurrentUrl());  
        $customerLoginURL = $this->getBaseUrl() . "customer/account/login";  
        Mage::app()->getFrontController()->getResponse()->setRedirect($customerLoginURL)->sendResponse();  
}
?>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章