This adds a simple way to detect the country of your customer.
By default, the module sets a session variable you can use in your own programming.
for example:
if($_SESSION['customers_geo_iso'] == "CA") {some nice PHP code here...;}
It also sets $_SESSION['customers_geo_country'] with the text name of the country.
To make it a small bit useful out of the box, it includes a mechanism to either deny or allow access to the site on a country by country basis, and to specify an action for blocked countries. The default is to send a header re-direct to google, but you can be creative here and customize this action.
The default here is to deny access to IP's originating in the countries listed at the beginning if the ipcheck.php file. Edit these (line 4) as you wish.
To change the default action to Allow Only, edit line 50 of ipcheck .php and add the negation char to the in_array statement.
ie:
if (!in_array($iso2, $ban_array)){
// what to do with banned countries. Default = send them to google...
header('Location: http://www.google.com/');
exit;
}
This will now allow access only to those countries defined at the top of the script.
Some other creative uses...
Here is where you must be creative. One example is if you own stores in different geographical areas, you can route customers to the proper store. For instance, you can easily route European customers to your .co.uk shop, and North American customers to your .com shop.
Another idea may be to set the store mode (normal vs showcase) based on customers location.
This is not 100% fool-proof as you can proxy around it if you are determined, but it has proven quite handy in some sites I do.
If you have any questions or find bad bugs, please post them to this thread.
Maybe post your nice code built using this.
There are some more details in the packages readme file.
Please be careful and test well before using this in a live shop.
Kiddo


Reply With Quote
