Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Persistent_Block_Form_Remember
  • Mage_Persistent_Block_Header_Additional
  • Mage_Persistent_Helper_Data
  • Mage_Persistent_Helper_Session
  • Mage_Persistent_IndexController
  • Mage_Persistent_Model_Observer
  • Mage_Persistent_Model_Observer_Session
  • Mage_Persistent_Model_Persistent_Config
  • Mage_Persistent_Model_Resource_Session
  • Mage_Persistent_Model_Session
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Persistent
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Persistent front controller
 29:  *
 30:  * @category   Mage
 31:  * @package    Mage_Persistent
 32:  * @author     Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_Persistent_IndexController extends Mage_Core_Controller_Front_Action
 35: {
 36:     /**
 37:      * Whether clear checkout session when logout
 38:      *
 39:      * @var bool
 40:      */
 41:     protected $_clearCheckoutSession = true;
 42: 
 43:     /**
 44:      * Set whether clear checkout session when logout
 45:      *
 46:      * @param bool $clear
 47:      * @return Mage_Persistent_IndexController
 48:      */
 49:     public function setClearCheckoutSession($clear = true)
 50:     {
 51:         $this->_clearCheckoutSession = $clear;
 52:         return $this;
 53:     }
 54: 
 55:     /**
 56:      * Retrieve 'persistent session' helper instance
 57:      *
 58:      * @return Mage_Persistent_Helper_Session
 59:      */
 60:     protected function _getHelper()
 61:     {
 62:         return Mage::helper('persistent/session');
 63:     }
 64: 
 65:     /**
 66:      * Unset persistent cookie action
 67:      */
 68:     public function unsetCookieAction()
 69:     {
 70:         if ($this->_getHelper()->isPersistent()) {
 71:             $this->_cleanup();
 72:         }
 73:         $this->_redirect('customer/account/login');
 74:         return;
 75:     }
 76: 
 77:     /**
 78:      * Revert all persistent data
 79:      *
 80:      * @return Mage_Persistent_IndexController
 81:      */
 82:     protected function _cleanup()
 83:     {
 84:         Mage::dispatchEvent('persistent_session_expired');
 85:         $customerSession = Mage::getSingleton('customer/session');
 86:         $customerSession
 87:             ->setCustomerId(null)
 88:             ->setCustomerGroupId(null);
 89:         if ($this->_clearCheckoutSession) {
 90:             Mage::getSingleton('checkout/session')->unsetAll();
 91:         }
 92:         $this->_getHelper()->getSession()->removePersistentCookie();
 93:         return $this;
 94:     }
 95: 
 96:     /**
 97:      * Save onepage checkout method to be register
 98:      */
 99:     public function saveMethodAction()
100:     {
101:         if ($this->_getHelper()->isPersistent()) {
102:             $this->_getHelper()->getSession()->removePersistentCookie();
103:             /** @var $customerSession Mage_Customer_Model_Session */
104:             $customerSession = Mage::getSingleton('customer/session');
105:             if (!$customerSession->isLoggedIn()) {
106:                 $customerSession->setCustomerId(null)
107:                     ->setCustomerGroupId(null);
108:             }
109: 
110:             Mage::getSingleton('persistent/observer')->setQuoteGuest();
111:         }
112: 
113:         $checkoutUrl = $this->_getRefererUrl();
114:         $this->_redirectUrl($checkoutUrl . (strpos($checkoutUrl, '?') ? '&' : '?') . 'register');
115:     }
116: 
117:     /**
118:      * Add appropriate session message and redirect to shopping cart
119:      * used for google checkout and paypal express checkout
120:      */
121:     public function expressCheckoutAction()
122:     {
123:         Mage::getSingleton('core/session')->addNotice(
124:             Mage::helper('persistent')->__('Shopping cart has been updated with appropriate prices')
125:         );
126:         $this->_redirect('checkout/cart');
127:     }
128: }
129: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0