steps:
1. Install the Mageworx geoip location extension
http://www.mageworx.com/geoip-location-magento-extension.html
2. Use the below code where you want to have the country code of the logged in user:
$rec = Mage::getModel('mageworx_geoip/geoip')->getLocation();
return $locData =$rec->getCode(); //this will return the country code for e.g. IN for India.
Note:: you can use $rec->getData(); to get all the below information:
IP, CODE ,COUNTRY ,FLAG
1. Install the Mageworx geoip location extension
http://www.mageworx.com/geoip-location-magento-extension.html
2. Use the below code where you want to have the country code of the logged in user:
$rec = Mage::getModel('mageworx_geoip/geoip')->getLocation();
return $locData =$rec->getCode(); //this will return the country code for e.g. IN for India.
Note:: you can use $rec->getData(); to get all the below information:
IP, CODE ,COUNTRY ,FLAG