Mage_Directory_Model_Region_Api Class Reference

Inheritance diagram for Mage_Directory_Model_Region_Api:

Mage_Api_Model_Resource_Abstract Mage_Directory_Model_Region_Api_V2

List of all members.

Public Member Functions

 items ($country)


Detailed Description

Definition at line 34 of file Api.php.


Member Function Documentation

items ( country  ) 

Retrieve regions list

Parameters:
string $country
Returns:
array

Definition at line 42 of file Api.php.

00043     {
00044         try {
00045             $country = Mage::getModel('directory/country')->loadByCode($country);
00046         } catch (Mage_Core_Exception $e) {
00047             $this->_fault('country_not_exists', $e->getMessage());
00048         }
00049 
00050         if (!$country->getId()) {
00051             $this->_fault('country_not_exists');
00052         }
00053 
00054         $result = array();
00055         foreach ($country->getRegions() as $region) {
00056             $region->getName();
00057             $result[] = $region->toArray(array('region_id', 'code', 'name'));
00058         }
00059 
00060         return $result;
00061     }


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

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