Jump to content

Page displayed according to geographical location


virtual

Recommended Posts

Hi All,

I was wondering if someone could point me in the right direction. I need to display prices on a web page according to geographical location.

E.g. If the client is in Europe I want to display the page with the prices in Euros and if he is in the US, display the page with prices in $. I know this is possible, but haven't a clue how to do it or what to search for specifically.

Thanx in advance

Link to comment
Share on other sites

Well using the GeoIP you'd still need to get the clients IP, but you'll need a list of IP's to test against, which it provides.

 

You could probably do some google searching for a list of GBP and/or EU IP addresses (for example 34.102.*.* could be a EU IP, so you'd have code that say if users IP in_array(list of Europe IP's) then display currency in pounds, else USD))

Link to comment
Share on other sites

A lot of sites avoid using a list of IP addresses by simply using a splash page that asks the user to choose their location and then redirects them to the correct location (and often these sites provide a simple way of allowing the user to switch locations by changing the option in an upper corner of the website).

 

You wouldn't necessarily need to create two different versions of the site to do this... You could use PHP to specify which version they should be viewing. For example, you could use a variable in the URL: yoursite.com/file.php?loc=us and then display the correct prices based on that variable.

 

for example, if the url was yoursite.com/file.php?loc=us you could use PHP like this:

 

<?php

if ($_GET['loc'] == 'us')
{
   echo "$9.99"; // display US price
}
else
{
   echo "€8.99"; // display euro version
}

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...