cancel
Showing results for 
Search instead for 
Did you mean: 

How to use with Country Name instead of Country Code?

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Re: How to use with Country Name instead of Country Code?

Hi @Aveeva ,

Good to know that it is working fine.

I have added only following three lines on code.

$countryName = ucwords(strtolower($countryId));
$countries = Mage::app()->getLocale()->getCountryTranslationList();;
$countryId = array_search($countryName, $countries);

line 1: I have converted country name to lovercase and then first word uppercase.
For example:
uNited STates will converted into "United States". Becuase line two contanis the array on country code and country name in form of Camel Case.

Line 3 : We have search country name in array and get country id.