LINK:- http://rosskendall.com/blog/web/using-geoip-with-magento-and-multiple-sites
code:- //GeoIP Track
define("GEOIP_DAT_FILE", "geoip/GeoIP.dat");
define("GEOIP_INC_FILE", "geoip/geoip.inc");
include(GEOIP_INC_FILE);
$_geoip = geoip_open(GEOIP_DAT_FILE ,GEOIP_STANDARD);
$_country_code = geoip_country_code_by_addr($_geoip, $_SERVER['REMOTE_ADDR']);
geoip_close($_geoip);
switch ($_country_code) {
case "GB": // United Kingdom
$_SERVER["MAGE_RUN_CODE"] = "uk";
break;
case "AU": // Australia
$_SERVER["MAGE_RUN_CODE"] = "au";
break;
case "NZ": // New Zealand
$_SERVER["MAGE_RUN_CODE"] = "nz";
break;
default:
$_SERVER["MAGE_RUN_CODE"] = "";
}
code:- //GeoIP Track
define("GEOIP_DAT_FILE", "geoip/GeoIP.dat");
define("GEOIP_INC_FILE", "geoip/geoip.inc");
include(GEOIP_INC_FILE);
$_geoip = geoip_open(GEOIP_DAT_FILE ,GEOIP_STANDARD);
$_country_code = geoip_country_code_by_addr($_geoip, $_SERVER['REMOTE_ADDR']);
geoip_close($_geoip);
switch ($_country_code) {
case "GB": // United Kingdom
$_SERVER["MAGE_RUN_CODE"] = "uk";
break;
case "AU": // Australia
$_SERVER["MAGE_RUN_CODE"] = "au";
break;
case "NZ": // New Zealand
$_SERVER["MAGE_RUN_CODE"] = "nz";
break;
default:
$_SERVER["MAGE_RUN_CODE"] = "";
}
No comments:
Post a Comment