I want to set My store Currency Based on the customer country.
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$ipdat = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip));
echo $ipdat->geoplugin_countryCode; // Here i am getting the country code
if($ipdat->geoplugin_countryCode == 'US'){
Mage::app()->getStore()->setCurrentCurrencyCode('USD'); // i tried this
}
?>
Mage::app()->getStore()->setCurrentCurrencyCode('USD');
I tried this but it is giving the following error.
Why is it giving an error ?
any Idea?