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:  * Shopping cart abstract block
 29:  *
 30:  * @category    Mage
 31:  * @package     Mage_Checkout
 32:  * @author      Magento Core Team <core@magentocommerce.com>
 33:  */
 34: abstract class Mage_Checkout_Block_Cart_Abstract extends Mage_Core_Block_Template
 35: {
 36:     protected $_customer = null;
 37:     protected $_checkout = null;
 38:     protected $_quote    = null;
 39: 
 40:     protected $_totals;
 41:     protected $_itemRenders = array();
 42: 
 43:     public function __construct()
 44:     {
 45:         parent::__construct();
 46:         $this->addItemRender('default', 'checkout/cart_item_renderer', 'checkout/cart/item/default.phtml');
 47:     }
 48: 
 49:     /**
 50:      * Add renderer for item product type
 51:      *
 52:      * @param   string $productType
 53:      * @param   string $blockType
 54:      * @param   string $template
 55:      * @return  Mage_Checkout_Block_Cart_Abstract
 56:      */
 57:     public function addItemRender($productType, $blockType, $template)
 58:     {
 59:         $this->_itemRenders[$productType] = array(
 60:             'block' => $blockType,
 61:             'template' => $template,
 62:             'blockInstance' => null
 63:         );
 64:         return $this;
 65:     }
 66: 
 67:     /**
 68:      * Get renderer information by product type code
 69:      *
 70:      * @deprecated please use getItemRendererInfo() method instead
 71:      * @see getItemRendererInfo()
 72:      * @param   string $type
 73:      * @return  array
 74:      */
 75:     public function getItemRender($type)
 76:     {
 77:         return $this->getItemRendererInfo($type);
 78:     }
 79: 
 80:     /**
 81:      * Get renderer information by product type code
 82:      *
 83:      * @param   string $type
 84:      * @return  array
 85:      */
 86:     public function getItemRendererInfo($type)
 87:     {
 88:         if (isset($this->_itemRenders[$type])) {
 89:             return $this->_itemRenders[$type];
 90:         }
 91:         return $this->_itemRenders['default'];
 92:      }
 93: 
 94:     /**
 95:      * Get renderer block instance by product type code
 96:      *
 97:      * @param   string $type
 98:      * @return  array
 99:      */
100:     public function getItemRenderer($type)
101:     {
102:         if (!isset($this->_itemRenders[$type])) {
103:             $type = 'default';
104:         }
105:         if (is_null($this->_itemRenders[$type]['blockInstance'])) {
106:              $this->_itemRenders[$type]['blockInstance'] = $this->getLayout()
107:                 ->createBlock($this->_itemRenders[$type]['block'])
108:                     ->setTemplate($this->_itemRenders[$type]['template'])
109:                     ->setRenderedBlock($this);
110:         }
111: 
112:         return $this->_itemRenders[$type]['blockInstance'];
113:     }
114: 
115: 
116:     /**
117:      * Get logged in customer
118:      *
119:      * @return Mage_Customer_Model_Customer
120:      */
121:     public function getCustomer()
122:     {
123:         if (null === $this->_customer) {
124:             $this->_customer = Mage::getSingleton('customer/session')->getCustomer();
125:         }
126:         return $this->_customer;
127:     }
128: 
129:     /**
130:      * Get checkout session
131:      *
132:      * @return Mage_Checkout_Model_Session
133:      */
134:     public function getCheckout()
135:     {
136:         if (null === $this->_checkout) {
137:             $this->_checkout = Mage::getSingleton('checkout/session');
138:         }
139:         return $this->_checkout;
140:     }
141: 
142:     /**
143:      * Get active quote
144:      *
145:      * @return Mage_Sales_Model_Quote
146:      */
147:     public function getQuote()
148:     {
149:         if (null === $this->_quote) {
150:             $this->_quote = $this->getCheckout()->getQuote();
151:         }
152:         return $this->_quote;
153:     }
154: 
155:     /**
156:      * Get all cart items
157:      *
158:      * @return array
159:      */
160:     public function getItems()
161:     {
162:         return $this->getQuote()->getAllVisibleItems();
163:     }
164: 
165:     /**
166:      * Get item row html
167:      *
168:      * @param   Mage_Sales_Model_Quote_Item $item
169:      * @return  string
170:      */
171:     public function getItemHtml(Mage_Sales_Model_Quote_Item $item)
172:     {
173:         $renderer = $this->getItemRenderer($item->getProductType())->setItem($item);
174:         return $renderer->toHtml();
175:     }
176: 
177:     public function getTotals()
178:     {
179:         return $this->getTotalsCache();
180:     }
181: 
182:     public function getTotalsCache()
183:     {
184:         if (empty($this->_totals)) {
185:             $this->_totals = $this->getQuote()->getTotals();
186:         }
187:         return $this->_totals;
188:     }
189: 
190:     /**
191:      * Check if can apply msrp to totals
192:      *
193:      * @return bool
194:      */
195:     public function canApplyMsrp()
196:     {
197:         if (!$this->getQuote()->hasCanApplyMsrp() && Mage::helper('catalog')->isMsrpEnabled()) {
198:             $this->getQuote()->collectTotals();
199:         }
200:         return $this->getQuote()->getCanApplyMsrp();
201:     }
202: }
203: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0