0

セッションの有効期限が切れた後、プログラムで設定したり、ユーザーをリダイレクトしたりするにはどうすればよいですか? ログイン時に、ユーザーは指定されたストア ビューにリダイレクトされます。このストア ビューは、ログインしているユーザーのみが利用できます。セッションの有効期限が切れると、ユーザーをデフォルトのストア ビューにリダイレクトします。

4

1 に答える 1

0

Core/Model/App.php _checkCookieStore メソッドを修正しました

protected function _checkCookieStore($type)
    {
        if (!$this->getCookie()->get()) {
            return $this;
        }

        $session = Mage::getSingleton('customer/session', array('name'=>'frontend'));
        if (!$session->isLoggedIn()) {
            unset($_COOKIE['store']);
        }
        $store = $this->getCookie()->get(Mage_Core_Model_Store::COOKIE_NAME);
        if ($store && isset($this->_stores[$store])
            && $this->_stores[$store]->getId()
            && $this->_stores[$store]->getIsActive()) {
            if ($type == 'website'
                && $this->_stores[$store]->getWebsiteId() == $this->_stores[$this->_currentStore]->getWebsiteId()) {
                $this->_currentStore = $store;
            }
            if ($type == 'group'
                && $this->_stores[$store]->getGroupId() == $this->_stores[$this->_currentStore]->getGroupId()) {
                $this->_currentStore = $store;
            }
            if ($type == 'store') {
                $this->_currentStore = $store;
            }
        }
        return $this;
    }  

セッションがログインしていない場合は、ストア Cookie の設定を解除します。

于 2013-02-18T09:01:28.847 に答える