Mage_Customer_Model_Address_Config Class Reference

Inheritance diagram for Mage_Customer_Model_Address_Config:

Mage_Core_Model_Config_Base Varien_Simplexml_Config

List of all members.

Public Member Functions

 __construct ()
 getFormats ()
 getFormatByCode ($typeCode)

Public Attributes

const DEFAULT_ADDRESS_RENDERER = 'customer/address_renderer_default'
const DEFAULT_ADDRESS_FORMAT = 'oneline'

Protected Member Functions

 _getDefaultFormat ()

Protected Attributes

 $_types
 $_defaultType


Detailed Description

Definition at line 35 of file Config.php.


Constructor & Destructor Documentation

__construct (  ) 

Definition at line 43 of file Config.php.

00044     {
00045         parent::__construct(Mage::getConfig()->getNode()->global->customer->address);
00046     }


Member Function Documentation

_getDefaultFormat (  )  [protected]

Definition at line 76 of file Config.php.

00077     {
00078         if(is_null($this->_defaultType)) {
00079             $this->_defaultType = new Varien_Object();
00080             $this->_defaultType->setCode('default')
00081                 ->setDefaultFormat('{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}, {{var street}}, {{var city}}, {{var region}} {{var postcode}}, {{var country}}');
00082 
00083             $this->_defaultType->setRenderer(
00084                 Mage::helper('customer/address')
00085                     ->getRenderer(self::DEFAULT_ADDRESS_RENDERER)->setType($this->_defaultType)
00086             );
00087         }
00088         return $this->_defaultType;
00089     }

getFormatByCode ( typeCode  ) 

Definition at line 91 of file Config.php.

00092     {
00093         foreach($this->getFormats() as $type) {
00094             if($type->getCode()==$typeCode) {
00095                 return $type;
00096             }
00097         }
00098         return $this->_getDefaultFormat();
00099     }

getFormats (  ) 

Definition at line 48 of file Config.php.

00049     {
00050         if(is_null($this->_types)) {
00051             $this->_types = array();
00052             foreach($this->getNode('formats')->children() as $typeCode=>$typeConfig) {
00053                 $type = new Varien_Object();
00054                 $type->setCode($typeCode)
00055                     ->setTitle((string)$typeConfig->title)
00056                     ->setDefaultFormat((string)$typeConfig->defaultFormat)
00057                     ->setHtmlEscape((bool)$typeConfig->htmlEscape);
00058 
00059                 $renderer = (string)$typeConfig->renderer;
00060                 if (!$renderer) {
00061                     $renderer = self::DEFAULT_ADDRESS_RENDERER;
00062                 }
00063 
00064                 $type->setRenderer(
00065                     Mage::helper('customer/address')
00066                         ->getRenderer($renderer)->setType($type)
00067                 );
00068 
00069                 $this->_types[] = $type;
00070             }
00071         }
00072 
00073         return $this->_types;
00074     }


Member Data Documentation

$_defaultType [protected]

Definition at line 41 of file Config.php.

$_types [protected]

Definition at line 40 of file Config.php.

const DEFAULT_ADDRESS_FORMAT = 'oneline'

Definition at line 38 of file Config.php.

const DEFAULT_ADDRESS_RENDERER = 'customer/address_renderer_default'

Definition at line 37 of file Config.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:03 2009 for Magento by  doxygen 1.5.8