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_Usa_Block_Adminhtml_Dhl_Unitofmeasure
  • Mage_Usa_Helper_Data
  • Mage_Usa_Model_Shipping_Carrier_Abstract
  • Mage_Usa_Model_Shipping_Carrier_Abstract_Source_Mode
  • Mage_Usa_Model_Shipping_Carrier_Abstract_Source_Requesttype
  • Mage_Usa_Model_Shipping_Carrier_Dhl
  • Mage_Usa_Model_Shipping_Carrier_Dhl_International
  • Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Contenttype
  • Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Abstract
  • Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Doc
  • Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Freedoc
  • Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Freenondoc
  • Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Nondoc
  • Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Size
  • Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Unitofmeasure
  • Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf
  • Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page
  • Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder
  • Mage_Usa_Model_Shipping_Carrier_Dhl_Source_Dutypaymenttype
  • Mage_Usa_Model_Shipping_Carrier_Dhl_Source_Freemethod
  • Mage_Usa_Model_Shipping_Carrier_Dhl_Source_Method
  • Mage_Usa_Model_Shipping_Carrier_Dhl_Source_Protection_Rounding
  • Mage_Usa_Model_Shipping_Carrier_Dhl_Source_Protection_Value
  • Mage_Usa_Model_Shipping_Carrier_Dhl_Source_Shipmenttype
  • Mage_Usa_Model_Shipping_Carrier_Fedex
  • Mage_Usa_Model_Shipping_Carrier_Fedex_Source_Dropoff
  • Mage_Usa_Model_Shipping_Carrier_Fedex_Source_Freemethod
  • Mage_Usa_Model_Shipping_Carrier_Fedex_Source_Method
  • Mage_Usa_Model_Shipping_Carrier_Fedex_Source_Packaging
  • Mage_Usa_Model_Shipping_Carrier_Ups
  • Mage_Usa_Model_Shipping_Carrier_Ups_Source_Container
  • Mage_Usa_Model_Shipping_Carrier_Ups_Source_DestType
  • Mage_Usa_Model_Shipping_Carrier_Ups_Source_Freemethod
  • Mage_Usa_Model_Shipping_Carrier_Ups_Source_Method
  • Mage_Usa_Model_Shipping_Carrier_Ups_Source_OriginShipment
  • Mage_Usa_Model_Shipping_Carrier_Ups_Source_Pickup
  • Mage_Usa_Model_Shipping_Carrier_Ups_Source_Type
  • Mage_Usa_Model_Shipping_Carrier_Ups_Source_Unitofmeasure
  • Mage_Usa_Model_Shipping_Carrier_Usps
  • Mage_Usa_Model_Shipping_Carrier_Usps_Source_Container
  • Mage_Usa_Model_Shipping_Carrier_Usps_Source_Freemethod
  • Mage_Usa_Model_Shipping_Carrier_Usps_Source_Machinable
  • Mage_Usa_Model_Shipping_Carrier_Usps_Source_Method
  • Mage_Usa_Model_Shipping_Carrier_Usps_Source_Size
  • 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_Usa
 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:  * Usa data helper
 29:  *
 30:  * @author      Magento Core Team <core@magentocommerce.com>
 31:  */
 32: class Mage_Usa_Helper_Data extends Mage_Core_Helper_Abstract
 33: {
 34:     /**
 35:      * Convert weight in different measure types
 36:      *
 37:      * @param  mixed $value
 38:      * @param  string $sourceWeightMeasure
 39:      * @param  string $toWeightMeasure
 40:      * @return int|null|string
 41:      */
 42:     public function convertMeasureWeight($value, $sourceWeightMeasure, $toWeightMeasure)
 43:     {
 44:         if ($value) {
 45:             $locale = Mage::app()->getLocale()->getLocale();
 46:             $unitWeight = new Zend_Measure_Weight($value, $sourceWeightMeasure, $locale);
 47:             $unitWeight->setType($toWeightMeasure);
 48:             return $unitWeight->getValue();
 49:         }
 50:         return null;
 51:     }
 52: 
 53:     /**
 54:      * Convert dimensions in different measure types
 55:      *
 56:      * @param  mixed $value
 57:      * @param  string $sourceDimensionMeasure
 58:      * @param  string $toDimensionMeasure
 59:      * @return int|null|string
 60:      */
 61:     public function convertMeasureDimension($value, $sourceDimensionMeasure, $toDimensionMeasure)
 62:     {
 63:         if ($value) {
 64:             $locale = Mage::app()->getLocale()->getLocale();
 65:             $unitDimension = new Zend_Measure_Length($value, $sourceDimensionMeasure, $locale);
 66:             $unitDimension->setType($toDimensionMeasure);
 67:             return $unitDimension->getValue();
 68:         }
 69:         return null;
 70:     }
 71: 
 72:     /**
 73:      * Get name of measure by its type
 74:      *
 75:      * @param  $key
 76:      * @return string
 77:      */
 78:     public function getMeasureWeightName($key)
 79:     {
 80:         $weight = new Zend_Measure_Weight(0);
 81:         $conversionList = $weight->getConversionList();
 82:         if (!empty($conversionList[$key]) && !empty($conversionList[$key][1])) {
 83:             return $conversionList[$key][1];
 84:         }
 85:         return '';
 86:     }
 87: 
 88:     /**
 89:      * Get name of measure by its type
 90:      *
 91:      * @param  $key
 92:      * @return string
 93:      */
 94:     public function getMeasureDimensionName($key)
 95:     {
 96:         $weight = new Zend_Measure_Length(0);
 97:         $conversionList = $weight->getConversionList();
 98:         if (!empty($conversionList[$key]) && !empty($conversionList[$key][1])) {
 99:             return $conversionList[$key][1];
100:         }
101:         return '';
102:     }
103: 
104:     /**
105:      * Define if we need girth parameter in the package window
106:      *
107:      * @param string $shippingMethod
108:      * @return bool
109:      */
110:     public function displayGirthValue($shippingMethod)
111:     {
112:         if (in_array($shippingMethod, array(
113:             'usps_Priority Mail International',
114:             'usps_Priority Mail International Small Flat Rate Box',
115:             'usps_Priority Mail International Medium Flat Rate Box',
116:             'usps_Priority Mail International Large Flat Rate Box',
117:             'usps_Priority Mail International Flat Rate Envelope',
118:             'usps_Express Mail International Flat Rate Envelope',
119:             'usps_Express Mail Hold For Pickup',
120:             'usps_Express Mail International',
121:             'usps_First-Class Mail International Package',
122:             'usps_First-Class Mail International Parcel',
123:             'usps_First-Class Mail International Large Envelope',
124:             'usps_First-Class Mail International',
125:             'usps_Global Express Guaranteed (GXG)',
126:             'usps_USPS GXG Envelopes',
127:             'usps_Global Express Guaranteed Non-Document Non-Rectangular',
128:             'usps_Media Mail',
129:             'usps_Parcel Post',
130:             'usps_Express Mail',
131:             'usps_Priority Mail'
132:         ))) {
133:             return true;
134:         } else {
135:             return false;
136:         }
137:     }
138: }
139: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0