Mage_Customer_Model_Entity_Address_Attribute_Backend_Region Class Reference

Inheritance diagram for Mage_Customer_Model_Entity_Address_Attribute_Backend_Region:

Mage_Eav_Model_Entity_Attribute_Backend_Abstract Mage_Eav_Model_Entity_Attribute_Backend_Interface

List of all members.

Public Member Functions

 beforeSave ($object)


Detailed Description

Definition at line 34 of file Region.php.


Member Function Documentation

beforeSave ( object  ) 

Reimplemented from Mage_Eav_Model_Entity_Attribute_Backend_Abstract.

Definition at line 36 of file Region.php.

00037     {
00038         $region = $object->getData('region');
00039         if ($regionId = (int) $region) {
00040             $regionModel = Mage::getModel('directory/region')->load($regionId);
00041             if ($regionModel->getId()) {
00042                 if ($object->getCountryId()==$regionModel->getCountryId()) {
00043                     $object->setRegionId($regionModel->getId())
00044                         ->setRegion($regionModel->getName());
00045                 }
00046                 else {
00047                     Mage::throwException(Mage::helper('customer')->__('Wrong region id by selected country'));
00048                 }
00049             }
00050         }
00051         return $this;
00052     }


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

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