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: class Mage_Checkout_Block_Cart_Shipping extends Mage_Checkout_Block_Cart_Abstract
 29: {
 30:     /**
 31:      * Available Carriers Instances
 32:      * @var null|array
 33:      */
 34:     protected $_carriers = null;
 35: 
 36:     /**
 37:      * Estimate Rates
 38:      * @var array
 39:      */
 40:     protected $_rates = array();
 41: 
 42:     /**
 43:      * Address Model
 44:      *
 45:      * @var array
 46:      */
 47:     protected $_address = array();
 48: 
 49:     /**
 50:      * Get Estimate Rates
 51:      *
 52:      * @return array
 53:      */
 54:     public function getEstimateRates()
 55:     {
 56:         if (empty($this->_rates)) {
 57:             $groups = $this->getAddress()->getGroupedAllShippingRates();
 58:             $this->_rates = $groups;
 59:         }
 60:         return $this->_rates;
 61:     }
 62: 
 63:     /**
 64:      * Get Address Model
 65:      *
 66:      * @return Mage_Sales_Model_Quote_Address
 67:      */
 68:     public function getAddress()
 69:     {
 70:         if (empty($this->_address)) {
 71:             $this->_address = $this->getQuote()->getShippingAddress();
 72:         }
 73:         return $this->_address;
 74:     }
 75: 
 76:     /**
 77:      * Get Carrier Name
 78:      *
 79:      * @param string $carrierCode
 80:      * @return mixed
 81:      */
 82:     public function getCarrierName($carrierCode)
 83:     {
 84:         if ($name = Mage::getStoreConfig('carriers/'.$carrierCode.'/title')) {
 85:             return $name;
 86:         }
 87:         return $carrierCode;
 88:     }
 89: 
 90:     /**
 91:      * Get Shipping Method
 92:      *
 93:      * @return string
 94:      */
 95:     public function getAddressShippingMethod()
 96:     {
 97:         return $this->getAddress()->getShippingMethod();
 98:     }
 99: 
100:     /**
101:      * Get Estimate Country Id
102:      *
103:      * @return string
104:      */
105:     public function getEstimateCountryId()
106:     {
107:         return $this->getAddress()->getCountryId();
108:     }
109: 
110:     /**
111:      * Get Estimate Postcode
112:      *
113:      * @return string
114:      */
115:     public function getEstimatePostcode()
116:     {
117:         return $this->getAddress()->getPostcode();
118:     }
119: 
120:     /**
121:      * Get Estimate City
122:      *
123:      * @return string
124:      */
125:     public function getEstimateCity()
126:     {
127:         return $this->getAddress()->getCity();
128:     }
129: 
130:     /**
131:      * Get Estimate Region Id
132:      *
133:      * @return mixed
134:      */
135:     public function getEstimateRegionId()
136:     {
137:         return $this->getAddress()->getRegionId();
138:     }
139: 
140:     /**
141:      * Get Estimate Region
142:      *
143:      * @return string
144:      */
145:     public function getEstimateRegion()
146:     {
147:         return $this->getAddress()->getRegion();
148:     }
149: 
150:     /**
151:      * Show City in Shipping Estimation
152:      *
153:      * @return bool
154:      */
155:     public function getCityActive()
156:     {
157:         return (bool)Mage::getStoreConfig('carriers/dhl/active')
158:             || (bool)Mage::getStoreConfig('carriers/dhlint/active');
159:     }
160: 
161:     /**
162:      * Show State in Shipping Estimation
163:      *
164:      * @return bool
165:      */
166:     public function getStateActive()
167:     {
168:         return (bool)Mage::getStoreConfig('carriers/dhl/active')
169:             || (bool)Mage::getStoreConfig('carriers/tablerate/active')
170:             || (bool)Mage::getStoreConfig('carriers/dhlint/active');
171:     }
172: 
173:     /**
174:      * Convert price from default currency to current currency
175:      *
176:      * @param float $price
177:      * @return float
178:      */
179:     public function formatPrice($price)
180:     {
181:         return $this->getQuote()->getStore()->convertPrice($price, true);
182:     }
183: 
184:     /**
185:      * Get Shipping Price
186:      *
187:      * @param float $price
188:      * @param bool $flag
189:      * @return float
190:      */
191:     public function getShippingPrice($price, $flag)
192:     {
193:         return $this->formatPrice($this->helper('tax')->getShippingPrice(
194:             $price,
195:             $flag,
196:             $this->getAddress(),
197:             $this->getQuote()->getCustomerTaxClassId()
198:         ));
199:     }
200: 
201:     /**
202:      * Obtain available carriers instances
203:      *
204:      * @return array
205:      */
206:     public function getCarriers()
207:     {
208:         if (null === $this->_carriers) {
209:             $this->_carriers = array();
210:             $this->getEstimateRates();
211:             foreach ($this->_rates as $rateGroup) {
212:                 if (!empty($rateGroup)) {
213:                     foreach ($rateGroup as $rate) {
214:                         $this->_carriers[] = $rate->getCarrierInstance();
215:                     }
216:                 }
217:             }
218:         }
219:         return $this->_carriers;
220:     }
221: 
222:     /**
223:      * Check if one of carriers require state/province
224:      *
225:      * @return bool
226:      */
227:     public function isStateProvinceRequired()
228:     {
229:         foreach ($this->getCarriers() as $carrier) {
230:             if ($carrier->isStateProvinceRequired()) {
231:                 return true;
232:             }
233:         }
234:         return false;
235:     }
236: 
237:     /**
238:      * Check if one of carriers require city
239:      *
240:      * @return bool
241:      */
242:     public function isCityRequired()
243:     {
244:         foreach ($this->getCarriers() as $carrier) {
245:             if ($carrier->isCityRequired()) {
246:                 return true;
247:             }
248:         }
249:         return false;
250:     }
251: 
252:     /**
253:      * Check if one of carriers require zip code
254:      *
255:      * @return bool
256:      */
257:     public function isZipCodeRequired()
258:     {
259:         foreach ($this->getCarriers() as $carrier) {
260:             if ($carrier->isZipCodeRequired($this->getEstimateCountryId())) {
261:                 return true;
262:             }
263:         }
264:         return false;
265:     }
266: }
267: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0