$collection = Mage::getModel('custom/table')->getCollection();
I have one custom table and there is one field country_code.
Now I am passing this $collection to my javascript and using variables in that.
Now I want to display country name instead of country code.
Is there any way from which I can add country name in my collection using join query or any way else ?
so before passing to js I want country name in my collection object.
Locale loc = new Locale("NL"); loc. getCountry();
ARE is the three-letter country abbreviation for United Arab Emirates.
ID is the two-letter country abbreviation for Indonesia.
Country codes are a group of numbers you enter before dialing the number of the person in the country you are calling. The country code is entered after the international calling code or prefix. Each country has its own unique code. For example, the country code for the United States is +1.
Magento stores the country names in locale files so that you can change the country name based on your language.
If you have the country code and you want to get the country name use the below code:
$country_name=Mage::app()->getLocale()->getCountryTranslation($country_code);
Or you can also try
// $countryCode looks like "US"
$country = Mage::getModel('directory/country')->loadByCode($countryCode);
echo $country->getName(); /
Please let me know if i can help you more.
you can get country name from
$countryModel = Mage::getModel('directory/country')->loadByCode('country_code');
$countryName = $countryModel->getName();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With