• Resolved Luddington

    (@luddington)


    Hi, just started with this plugin and it looks great but is there a way of switching the results to Amazon UK instead of Amazon US? My readers mostly come from UK – Thanks

Viewing 1 replies (of 1 total)
  • Plugin Author Jake Evans

    (@forwardcreation)

    After talking with David further, the following is the official fix, to be included in future updates:

    In savedbookactions.php, the following code was added directly underneath “$amazondetpage = filter_var($saved_book->amazondetailpage, FILTER_SANITIZE_URL);”

    // Following code is to direct visitors to the UK amazon if they’re in the UK, based off their IP
    // Getting user’s ip
    $ip;
    if (!empty($_SERVER[‘HTTP_CLIENT_IP’])) {
    $ip = $_SERVER[‘HTTP_CLIENT_IP’];
    } elseif (! empty($_SERVER[‘HTTP_X_FORWARDED_FOR’]))
    {
    $ip = $_SERVER[‘HTTP_X_FORWARDED_FOR’];
    } else {
    $ip = $_SERVER[‘REMOTE_ADDR’];
    }

    // Getting country based on ip
    $xml = simplexml_load_file(“https://www.geoplugin.net/xml.gp?ip=”.$ip);

    // Checking to see if the user’s site is in UK
    $visitor_country = $xml->geoplugin_countryName;
    if ($visitor_country == ‘United Kingdom’) {
    $amazondetpage = str_replace(“.com”,”.co.uk”, $amazondetpage);
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Select UK’ is closed to new replies.