Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get State name from region_id Magento 1.6.2

Tags:

class

magento

I need to display a single State Name in Magento 1.6.2 by converting the region_id to the state name.

I have the region_id and can return the array of all US states with

$states = Mage::getModel('directory/country')->load('US')->getRegions();

but cannot find a help class that converts the region_id.

like image 892
Bill Kellaway Avatar asked Aug 24 '12 18:08

Bill Kellaway


1 Answers

$regionId = 27;
$region = Mage::getModel('directory/region')->load($regionId);
echo $region->getName();
like image 68
ivantedja Avatar answered Oct 11 '22 23:10

ivantedja