Landingpages不同的语言

时间:2014-11-04 09:36:47

标签: magento

我有一个3种语言的magento网站 英语 荷兰 德国。

我的问题是,我希望德国人能够访问德语语言页面,将英语访问英语语言页面。

1 个答案:

答案 0 :(得分:0)

     <?php

        define("GEOIP_DAT_FILE", $_SERVER['DOCUMENT_ROOT'] . "/geoip/GeoIP.dat");
        define("GEOIP_INC_FILE", $_SERVER['DOCUMENT_ROOT'] . "/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"] = "base";
        }

        ?>
Please use this code it will help to you, for complete your task, also  please see this link: http://rosskendall.com/blog/web/using-geoip-with-magento-and-multiple-sites