Monday, 16 March 2015

countryCode looks like US in magento


// $countryCode looks like "US"

$customer = Mage::getSingleton('customer/session')->getCustomer();
$countryCode = $customer->getDefaultBillingAddress()->getCountry();

// looks like "United States"

$country = Mage::getModel('directory/country')->loadByCode($countryCode);
echo $country->getName();


// $regionCode looks like "UP"

$customer = Mage::getSingleton('customer/session')->getCustomer();
$regionCode = $customer->getDefaultBillingAddress()->getRegioncode();



No comments:

Post a Comment