天天看點

magento登入後傳回目前頁面

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();
}
           

代碼加在Head.php或controller中實作