*/ class Mage_Sales_Model_Resource_Quote_Address_Attribute_Backend_Region extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { /** * Set region to the attribute * * @param Varien_Object $object * @return Mage_Sales_Model_Resource_Quote_Address_Attribute_Backend_Region */ public function beforeSave($object) { if (is_numeric($object->getRegion())) { $region = Mage::getModel('directory/region')->load((int)$object->getRegion()); if ($region) { $object->setRegionId($region->getId()); $object->setRegion($region->getCode()); } } return $this; } }