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_Checkout_Block_Agreements
  • Mage_Checkout_Block_Cart
  • Mage_Checkout_Block_Cart_Abstract
  • Mage_Checkout_Block_Cart_Coupon
  • Mage_Checkout_Block_Cart_Crosssell
  • Mage_Checkout_Block_Cart_Item_Configure
  • Mage_Checkout_Block_Cart_Item_Renderer
  • Mage_Checkout_Block_Cart_Item_Renderer_Configurable
  • Mage_Checkout_Block_Cart_Item_Renderer_Grouped
  • Mage_Checkout_Block_Cart_Shipping
  • Mage_Checkout_Block_Cart_Sidebar
  • Mage_Checkout_Block_Cart_Totals
  • Mage_Checkout_Block_Links
  • Mage_Checkout_Block_Multishipping_Abstract
  • Mage_Checkout_Block_Multishipping_Address_Select
  • Mage_Checkout_Block_Multishipping_Addresses
  • Mage_Checkout_Block_Multishipping_Billing
  • Mage_Checkout_Block_Multishipping_Billing_Items
  • Mage_Checkout_Block_Multishipping_Link
  • Mage_Checkout_Block_Multishipping_Overview
  • Mage_Checkout_Block_Multishipping_Payment_Info
  • Mage_Checkout_Block_Multishipping_Shipping
  • Mage_Checkout_Block_Multishipping_State
  • Mage_Checkout_Block_Multishipping_Success
  • Mage_Checkout_Block_Onepage
  • Mage_Checkout_Block_Onepage_Abstract
  • Mage_Checkout_Block_Onepage_Billing
  • Mage_Checkout_Block_Onepage_Failure
  • Mage_Checkout_Block_Onepage_Link
  • Mage_Checkout_Block_Onepage_Login
  • Mage_Checkout_Block_Onepage_Payment
  • Mage_Checkout_Block_Onepage_Payment_Info
  • Mage_Checkout_Block_Onepage_Payment_Methods
  • Mage_Checkout_Block_Onepage_Progress
  • Mage_Checkout_Block_Onepage_Review
  • Mage_Checkout_Block_Onepage_Review_Info
  • Mage_Checkout_Block_Onepage_Shipping
  • Mage_Checkout_Block_Onepage_Shipping_Method
  • Mage_Checkout_Block_Onepage_Shipping_Method_Additional
  • Mage_Checkout_Block_Onepage_Shipping_Method_Available
  • Mage_Checkout_Block_Onepage_Success
  • Mage_Checkout_Block_Success
  • Mage_Checkout_Block_Total_Default
  • Mage_Checkout_Block_Total_Nominal
  • Mage_Checkout_Block_Total_Tax
  • Mage_Checkout_CartController
  • Mage_Checkout_Controller_Action
  • Mage_Checkout_Exception
  • Mage_Checkout_Helper_Cart
  • Mage_Checkout_Helper_Data
  • Mage_Checkout_Helper_Url
  • Mage_Checkout_IndexController
  • Mage_Checkout_Model_Agreement
  • Mage_Checkout_Model_Api_Resource
  • Mage_Checkout_Model_Api_Resource_Customer
  • Mage_Checkout_Model_Api_Resource_Product
  • Mage_Checkout_Model_Cart
  • Mage_Checkout_Model_Cart_Api
  • Mage_Checkout_Model_Cart_Api_V2
  • Mage_Checkout_Model_Cart_Coupon_Api
  • Mage_Checkout_Model_Cart_Coupon_Api_V2
  • Mage_Checkout_Model_Cart_Customer_Api
  • Mage_Checkout_Model_Cart_Customer_Api_V2
  • Mage_Checkout_Model_Cart_Payment_Api
  • Mage_Checkout_Model_Cart_Payment_Api_V2
  • Mage_Checkout_Model_Cart_Product_Api
  • Mage_Checkout_Model_Cart_Product_Api_V2
  • Mage_Checkout_Model_Cart_Shipping_Api
  • Mage_Checkout_Model_Cart_Shipping_Api_V2
  • Mage_Checkout_Model_Config_Source_Cart_Summary
  • Mage_Checkout_Model_Mysql4_Agreement
  • Mage_Checkout_Model_Mysql4_Agreement_Collection
  • Mage_Checkout_Model_Mysql4_Cart
  • Mage_Checkout_Model_Mysql4_Setup
  • Mage_Checkout_Model_Observer
  • Mage_Checkout_Model_Resource_Agreement
  • Mage_Checkout_Model_Resource_Agreement_Collection
  • Mage_Checkout_Model_Resource_Cart
  • Mage_Checkout_Model_Resource_Setup
  • Mage_Checkout_Model_Session
  • Mage_Checkout_Model_Type_Abstract
  • Mage_Checkout_Model_Type_Multishipping
  • Mage_Checkout_Model_Type_Multishipping_State
  • Mage_Checkout_Model_Type_Onepage
  • Mage_Checkout_Multishipping_AddressController
  • Mage_Checkout_MultishippingController
  • Mage_Checkout_OnepageController

Interfaces

  • Mage_Checkout_Model_Cart_Interface
  • 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_Checkout
 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:  * One page common functionality block
 29:  *
 30:  * @author      Magento Core Team <core@magentocommerce.com>
 31:  */
 32: abstract class Mage_Checkout_Block_Onepage_Abstract extends Mage_Core_Block_Template
 33: {
 34:     protected $_customer;
 35:     protected $_checkout;
 36:     protected $_quote;
 37:     protected $_countryCollection;
 38:     protected $_regionCollection;
 39:     protected $_addressesCollection;
 40: 
 41:     /**
 42:      * Get logged in customer
 43:      *
 44:      * @return Mage_Customer_Model_Customer
 45:      */
 46:     public function getCustomer()
 47:     {
 48:         if (empty($this->_customer)) {
 49:             $this->_customer = Mage::getSingleton('customer/session')->getCustomer();
 50:         }
 51:         return $this->_customer;
 52:     }
 53: 
 54:     /**
 55:      * Retrieve checkout session model
 56:      *
 57:      * @return Mage_Checkout_Model_Session
 58:      */
 59:     public function getCheckout()
 60:     {
 61:         if (empty($this->_checkout)) {
 62:             $this->_checkout = Mage::getSingleton('checkout/session');
 63:         }
 64:         return $this->_checkout;
 65:     }
 66: 
 67:     /**
 68:      * Retrieve sales quote model
 69:      *
 70:      * @return Mage_Sales_Model_Quote
 71:      */
 72:     public function getQuote()
 73:     {
 74:         if (empty($this->_quote)) {
 75:             $this->_quote = $this->getCheckout()->getQuote();
 76:         }
 77:         return $this->_quote;
 78:     }
 79: 
 80:     public function isCustomerLoggedIn()
 81:     {
 82:         return Mage::getSingleton('customer/session')->isLoggedIn();
 83:     }
 84: 
 85:     public function getCountryCollection()
 86:     {
 87:         if (!$this->_countryCollection) {
 88:             $this->_countryCollection = Mage::getSingleton('directory/country')->getResourceCollection()
 89:                 ->loadByStore();
 90:         }
 91:         return $this->_countryCollection;
 92:     }
 93: 
 94:     public function getRegionCollection()
 95:     {
 96:         if (!$this->_regionCollection) {
 97:             $this->_regionCollection = Mage::getModel('directory/region')->getResourceCollection()
 98:                 ->addCountryFilter($this->getAddress()->getCountryId())
 99:                 ->load();
100:         }
101:         return $this->_regionCollection;
102:     }
103: 
104:     public function customerHasAddresses()
105:     {
106:         return count($this->getCustomer()->getAddresses());
107:     }
108: 
109: /* */
110:     public function getAddressesHtmlSelect($type)
111:     {
112:         if ($this->isCustomerLoggedIn()) {
113:             $options = array();
114:             foreach ($this->getCustomer()->getAddresses() as $address) {
115:                 $options[] = array(
116:                     'value' => $address->getId(),
117:                     'label' => $address->format('oneline')
118:                 );
119:             }
120: 
121:             $addressId = $this->getAddress()->getCustomerAddressId();
122:             if (empty($addressId)) {
123:                 if ($type=='billing') {
124:                     $address = $this->getCustomer()->getPrimaryBillingAddress();
125:                 } else {
126:                     $address = $this->getCustomer()->getPrimaryShippingAddress();
127:                 }
128:                 if ($address) {
129:                     $addressId = $address->getId();
130:                 }
131:             }
132: 
133:             $select = $this->getLayout()->createBlock('core/html_select')
134:                 ->setName($type.'_address_id')
135:                 ->setId($type.'-address-select')
136:                 ->setClass('address-select')
137:                 ->setExtraParams('onchange="'.$type.'.newAddress(!this.value)"')
138:                 ->setValue($addressId)
139:                 ->setOptions($options);
140: 
141:             $select->addOption('', Mage::helper('checkout')->__('New Address'));
142: 
143:             return $select->getHtml();
144:         }
145:         return '';
146:     }
147: 
148:     public function getCountryHtmlSelect($type)
149:     {
150:         $countryId = $this->getAddress()->getCountryId();
151:         if (is_null($countryId)) {
152:             $countryId = Mage::helper('core')->getDefaultCountry();
153:         }
154:         $select = $this->getLayout()->createBlock('core/html_select')
155:             ->setName($type.'[country_id]')
156:             ->setId($type.':country_id')
157:             ->setTitle(Mage::helper('checkout')->__('Country'))
158:             ->setClass('validate-select')
159:             ->setValue($countryId)
160:             ->setOptions($this->getCountryOptions());
161:         if ($type === 'shipping') {
162:             $select->setExtraParams('onchange="if(window.shipping)shipping.setSameAsBilling(false);"');
163:         }
164: 
165:         return $select->getHtml();
166:     }
167: 
168: 
169:     public function getRegionHtmlSelect($type)
170:     {
171:         $select = $this->getLayout()->createBlock('core/html_select')
172:             ->setName($type.'[region]')
173:             ->setId($type.':region')
174:             ->setTitle(Mage::helper('checkout')->__('State/Province'))
175:             ->setClass('required-entry validate-state')
176:             ->setValue($this->getAddress()->getRegionId())
177:             ->setOptions($this->getRegionCollection()->toOptionArray());
178: 
179:         return $select->getHtml();
180:     }
181: 
182:     public function getCountryOptions()
183:     {
184:         $options    = false;
185:         $useCache   = Mage::app()->useCache('config');
186:         if ($useCache) {
187:             $cacheId    = 'DIRECTORY_COUNTRY_SELECT_STORE_' . Mage::app()->getStore()->getCode();
188:             $cacheTags  = array('config');
189:             if ($optionsCache = Mage::app()->loadCache($cacheId)) {
190:                 $options = unserialize($optionsCache);
191:             }
192:         }
193: 
194:         if ($options == false) {
195:             $options = $this->getCountryCollection()->toOptionArray();
196:             if ($useCache) {
197:                 Mage::app()->saveCache(serialize($options), $cacheId, $cacheTags);
198:             }
199:         }
200:         return $options;
201:     }
202: 
203:     /**
204:      * Get checkout steps codes
205:      *
206:      * @return array
207:      */
208:     protected function _getStepCodes()
209:     {
210:         return array('login', 'billing', 'shipping', 'shipping_method', 'payment', 'review');
211:     }
212: 
213: 
214:     /**
215:      * Retrieve is allow and show block
216:      *
217:      * @return bool
218:      */
219:     public function isShow()
220:     {
221:         return true;
222:     }
223: /* */
224: }
225: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0