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_Customer_AccountController
  • Mage_Customer_AddressController
  • Mage_Customer_Block_Account
  • Mage_Customer_Block_Account_Dashboard
  • Mage_Customer_Block_Account_Dashboard_Address
  • Mage_Customer_Block_Account_Dashboard_Block
  • Mage_Customer_Block_Account_Dashboard_Hello
  • Mage_Customer_Block_Account_Dashboard_Info
  • Mage_Customer_Block_Account_Dashboard_Newsletter
  • Mage_Customer_Block_Account_Dashboard_Sidebar
  • Mage_Customer_Block_Account_Forgotpassword
  • Mage_Customer_Block_Account_Navigation
  • Mage_Customer_Block_Account_Resetpassword
  • Mage_Customer_Block_Address_Book
  • Mage_Customer_Block_Address_Edit
  • Mage_Customer_Block_Address_Renderer_Default
  • Mage_Customer_Block_Form_Edit
  • Mage_Customer_Block_Form_Login
  • Mage_Customer_Block_Form_Register
  • Mage_Customer_Block_Newsletter
  • Mage_Customer_Block_Widget_Abstract
  • Mage_Customer_Block_Widget_Dob
  • Mage_Customer_Block_Widget_Gender
  • Mage_Customer_Block_Widget_Name
  • Mage_Customer_Block_Widget_Taxvat
  • Mage_Customer_Helper_Address
  • Mage_Customer_Helper_Data
  • Mage_Customer_Model_Address
  • Mage_Customer_Model_Address_Abstract
  • Mage_Customer_Model_Address_Api
  • Mage_Customer_Model_Address_Api_V2
  • Mage_Customer_Model_Address_Config
  • Mage_Customer_Model_Api2_Customer
  • Mage_Customer_Model_Api2_Customer_Address
  • Mage_Customer_Model_Api2_Customer_Address_Rest
  • Mage_Customer_Model_Api2_Customer_Address_Rest_Admin_V1
  • Mage_Customer_Model_Api2_Customer_Address_Rest_Customer_V1
  • Mage_Customer_Model_Api2_Customer_Address_Validator
  • Mage_Customer_Model_Api2_Customer_Rest
  • Mage_Customer_Model_Api2_Customer_Rest_Admin_V1
  • Mage_Customer_Model_Api2_Customer_Rest_Customer_V1
  • Mage_Customer_Model_Api_Resource
  • Mage_Customer_Model_Attribute
  • Mage_Customer_Model_Attribute_Backend_Data_Boolean
  • Mage_Customer_Model_Attribute_Data
  • Mage_Customer_Model_Attribute_Data_Abstract
  • Mage_Customer_Model_Attribute_Data_Boolean
  • Mage_Customer_Model_Attribute_Data_Date
  • Mage_Customer_Model_Attribute_Data_File
  • Mage_Customer_Model_Attribute_Data_Hidden
  • Mage_Customer_Model_Attribute_Data_Image
  • Mage_Customer_Model_Attribute_Data_Multiline
  • Mage_Customer_Model_Attribute_Data_Multiselect
  • Mage_Customer_Model_Attribute_Data_Postcode
  • Mage_Customer_Model_Attribute_Data_Select
  • Mage_Customer_Model_Attribute_Data_Text
  • Mage_Customer_Model_Attribute_Data_Textarea
  • Mage_Customer_Model_Config_Share
  • Mage_Customer_Model_Convert_Adapter_Customer
  • Mage_Customer_Model_Convert_Parser_Customer
  • Mage_Customer_Model_Customer
  • Mage_Customer_Model_Customer_Api
  • Mage_Customer_Model_Customer_Api_V2
  • Mage_Customer_Model_Customer_Attribute_Backend_Billing
  • Mage_Customer_Model_Customer_Attribute_Backend_Password
  • Mage_Customer_Model_Customer_Attribute_Backend_Shipping
  • Mage_Customer_Model_Customer_Attribute_Backend_Store
  • Mage_Customer_Model_Customer_Attribute_Backend_Website
  • Mage_Customer_Model_Customer_Attribute_Source_Group
  • Mage_Customer_Model_Customer_Attribute_Source_Store
  • Mage_Customer_Model_Customer_Attribute_Source_Website
  • Mage_Customer_Model_Entity_Address
  • Mage_Customer_Model_Entity_Address_Attribute_Backend_Region
  • Mage_Customer_Model_Entity_Address_Attribute_Backend_Street
  • Mage_Customer_Model_Entity_Address_Attribute_Collection
  • Mage_Customer_Model_Entity_Address_Attribute_Source_Country
  • Mage_Customer_Model_Entity_Address_Attribute_Source_Region
  • Mage_Customer_Model_Entity_Address_Collection
  • Mage_Customer_Model_Entity_Attribute
  • Mage_Customer_Model_Entity_Attribute_Collection
  • Mage_Customer_Model_Entity_Customer
  • Mage_Customer_Model_Entity_Customer_Collection
  • Mage_Customer_Model_Entity_Form_Attribute
  • Mage_Customer_Model_Entity_Form_Attribute_Collection
  • Mage_Customer_Model_Entity_Group
  • Mage_Customer_Model_Entity_Group_Collection
  • Mage_Customer_Model_Entity_Setup
  • Mage_Customer_Model_Entity_Wishlist_Collection
  • Mage_Customer_Model_Form
  • Mage_Customer_Model_Group
  • Mage_Customer_Model_Group_Api
  • Mage_Customer_Model_Group_Api_V2
  • Mage_Customer_Model_Observer
  • Mage_Customer_Model_Resource_Address
  • Mage_Customer_Model_Resource_Address_Attribute_Backend_Region
  • Mage_Customer_Model_Resource_Address_Attribute_Backend_Street
  • Mage_Customer_Model_Resource_Address_Attribute_Collection
  • Mage_Customer_Model_Resource_Address_Attribute_Source_Country
  • Mage_Customer_Model_Resource_Address_Attribute_Source_Region
  • Mage_Customer_Model_Resource_Address_Collection
  • Mage_Customer_Model_Resource_Attribute
  • Mage_Customer_Model_Resource_Attribute_Collection
  • Mage_Customer_Model_Resource_Customer
  • Mage_Customer_Model_Resource_Customer_Collection
  • Mage_Customer_Model_Resource_Form_Attribute
  • Mage_Customer_Model_Resource_Form_Attribute_Collection
  • Mage_Customer_Model_Resource_Group
  • Mage_Customer_Model_Resource_Group_Collection
  • Mage_Customer_Model_Resource_Setup
  • Mage_Customer_Model_Resource_Wishlist_Collection
  • Mage_Customer_Model_Session
  • Mage_Customer_ReviewController

Interfaces

  • Mage_Customer_Block_Address_Renderer_Interface

Exceptions

  • Mage_Customer_Exception
  • 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_Customer
 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: /**
 29:  * Customer address config
 30:  *
 31:  * @category   Mage
 32:  * @package    Mage_Customer
 33:  * @author     Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_Customer_Model_Address_Config extends Mage_Core_Model_Config_Base
 36: {
 37:     const DEFAULT_ADDRESS_RENDERER  = 'customer/address_renderer_default';
 38:     const XML_PATH_ADDRESS_TEMPLATE = 'customer/address_templates/';
 39:     const DEFAULT_ADDRESS_FORMAT    = 'oneline';
 40: 
 41:     /**
 42:      * Customer Address Templates per store
 43:      *
 44:      * @var array
 45:      */
 46:     protected $_types           = array();
 47: 
 48:     /**
 49:      * Current store instance
 50:      *
 51:      * @var Mage_Core_Model_Store
 52:      */
 53:     protected $_store           = null;
 54: 
 55:     /**
 56:      * Default types per store
 57:      * Using for invalid code
 58:      *
 59:      * @var array
 60:      */
 61:     protected $_defaultTypes    = array();
 62: 
 63:     public function setStore($store)
 64:     {
 65:         $this->_store = Mage::app()->getStore($store);
 66:         return $this;
 67:     }
 68: 
 69:     /**
 70:      * Retrieve store
 71:      *
 72:      * @return Mage_Core_Model_Store
 73:      */
 74:     public function getStore()
 75:     {
 76:         if (is_null($this->_store)) {
 77:             $this->_store = Mage::app()->getStore();
 78:         }
 79:         return $this->_store;
 80:     }
 81: 
 82:     /**
 83:      * Define node
 84:      *
 85:      */
 86:     public function __construct()
 87:     {
 88:         parent::__construct(Mage::getConfig()->getNode()->global->customer->address);
 89:     }
 90: 
 91:     /**
 92:      * Retrieve address formats
 93:      *
 94:      * @return array
 95:      */
 96:     public function getFormats()
 97:     {
 98:         $store = $this->getStore();
 99:         $storeId = $store->getId();
100:         if (!isset($this->_types[$storeId])) {
101:             $this->_types[$storeId] = array();
102:             foreach ($this->getNode('formats')->children() as $typeCode => $typeConfig) {
103:                 $path = sprintf('%s%s', self::XML_PATH_ADDRESS_TEMPLATE, $typeCode);
104:                 $type = new Varien_Object();
105:                 $htmlEscape = strtolower($typeConfig->htmlEscape);
106:                 $htmlEscape = $htmlEscape == 'false' || $htmlEscape == '0' || $htmlEscape == 'no'
107:                         || !strlen($typeConfig->htmlEscape) ? false : true;
108:                 $type->setCode($typeCode)
109:                     ->setTitle((string)$typeConfig->title)
110:                     ->setDefaultFormat(Mage::getStoreConfig($path, $store))
111:                     ->setHtmlEscape($htmlEscape);
112: 
113:                 $renderer = (string)$typeConfig->renderer;
114:                 if (!$renderer) {
115:                     $renderer = self::DEFAULT_ADDRESS_RENDERER;
116:                 }
117: 
118:                 $type->setRenderer(
119:                     Mage::helper('customer/address')->getRenderer($renderer)->setType($type)
120:                 );
121: 
122:                 $this->_types[$storeId][] = $type;
123:             }
124:         }
125: 
126:         return $this->_types[$storeId];
127:     }
128: 
129:     /**
130:      * Retrieve default address format
131:      *
132:      * @return Varien_Object
133:      */
134:     protected function _getDefaultFormat()
135:     {
136:         $store = $this->getStore();
137:         $storeId = $store->getId();
138:         if(!isset($this->_defaultType[$storeId])) {
139:             $this->_defaultType[$storeId] = new Varien_Object();
140:             $this->_defaultType[$storeId]->setCode('default')
141:                 ->setDefaultFormat('{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}'
142:                         . '{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}, '
143:                         . '{{var street}}, {{var city}}, {{var region}} {{var postcode}}, {{var country}}');
144: 
145:             $this->_defaultType[$storeId]->setRenderer(
146:                 Mage::helper('customer/address')
147:                     ->getRenderer(self::DEFAULT_ADDRESS_RENDERER)->setType($this->_defaultType[$storeId])
148:             );
149:         }
150:         return $this->_defaultType[$storeId];
151:     }
152: 
153:     /**
154:      * Retrieve address format by code
155:      *
156:      * @param string $typeCode
157:      * @return Varien_Object
158:      */
159:     public function getFormatByCode($typeCode)
160:     {
161:         foreach($this->getFormats() as $type) {
162:             if($type->getCode()==$typeCode) {
163:                 return $type;
164:             }
165:         }
166:         return $this->_getDefaultFormat();
167:     }
168: 
169: }
170: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0