PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

[MODULE] Location Detection - Detect the location of a visitor using their IP Address and automatically redirect them to the matching language

149 replies to this topic
#1
tomerg3

    PrestaShop Superstar

  • US Moderators
  • 5754 posts
This Module uses a local Database table to determine the location of a visitor based on their IP Address.

It automatically redirects them to the matching language (IE www.yourwebsite.com/lang-fr).

It only works if you have that language installed in Prestashop.

To see it in action, visit http://www.presto-changeo.com/

This module works on PS 1.1, 1.2 and 1.3, for 1.4+ see http://www.prestasho...wthread/105240/

http://www.presto-ch...op-free-modules

Version 1.1 has just been released including:

* Better language detection.
* Browser language detection.
* Matching Currency Selection.
* Easier Installation.

Version 1.2 was just released, it includes:

* Ability to edit the Country to Language and Currency codes
* Ability to disable the currency detection / selection
* Fix to some language codes
* Compatibility with Prestashop 1.1
* Better handling of language selection

V 1.3 was just released, it fixes a bug that was causing trouble when cookies were not enabled
It is highly recommended to upgrade to this version since the problem may have affected Search Engines


V 1.3.1 was just released, it fixes a bug the was causing an infinite redirect when both the location of the user, and the default browser language were different from the prestashop default language

It is recommended to upgrade to this version (1.3.1)

V1.4 has been released, it includes:

* Ability to choose a default language and currency (when the customer's local language is not available in your shop).
* Link a language to a currency (so when a customer clicks on a language flag, the currency changes too).
* Bug fix for currency detection (wasn't working if there was only 1 language)

V1.4.2 released, bug fix for linking language to currency in IE and safari, and now also works on page load.

V1.5 released, redirection bug fix when no cookies are present, fix for notices on first install, updated IP -> Country database

V1.5.1 released, it includes a fix for the language detection, and does a double redirect to avoid having ?redirected in the address

P.S
I have put a lot of hours in to this, so please consider a donation.
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

#2
shykoo

    PrestaShop Apprentice

  • Members
  • PipPip
  • 42 posts
Hi Tomerg3,

ThanX for your contribution...I downloaded the module but there are no instructions on how to upload, in particulr the install.sql

regards

Dan

#3
tomerg3

    PrestaShop Superstar

  • US Moderators
  • 5754 posts

From 1258911660:

Hi Tomerg3,

ThanX for your contribution...I downloaded the module but there are no instructions on how to upload, in particulr the install.sql

regards

Dan


When you click on the "install" button in the Modules tab in the backoffice, the database gets installed automatically.

Once that is done, click "configure" next to the module (it's under Tools) and you will see the instructions on how to hook it up to Prestashop (you need to copy a few lines to /header.php).
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

#4
metta

    PrestaShop Apprentice

  • Members
  • PipPip
  • 116 posts
This is a great module. A great benefit for international company. We will use it on our production site when it is live.

Thank you for sharing.

#5
Star

    PrestaShop Addict

  • Members
  • PipPipPip
  • 618 posts
This is a great idea to install something like this for international site. I emailed this link to all of the Japanese forum members.

Thanks for sharing.

One question: What about a Japanese lives in the U.S and has Japanese ad default language install. What language will this person see?

#6
tomerg3

    PrestaShop Superstar

  • US Moderators
  • 5754 posts

From 1258991150:

This is a great idea to install something like this for international site. I emailed this link to all of the Japanese forum members.

Thanks for sharing.

One question: What about a Japanese lives in the U.S and has Japanese ad default language install. What language will this person see?


You're welcome....

Right now they will see the default language, I will add that feature in the next version I release.
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

#7
Jack

    PrestaShop Apprentice

  • Members
  • PipPip
  • 239 posts
I love it. This is a must have module for international site. Thank you for sharing.

#8
tomerg3

    PrestaShop Superstar

  • US Moderators
  • 5754 posts

From 1258993049:

I love it. This is a must have module for international site. Thank you for sharing.


Thanks!

The following are also very useful for International sites (or those that want to become one)

Google Sitemap fix - http://www.prestasho...ewthread/35047/
Prevent page title duplication for multiple languages - http://www.prestasho...ewthread/35135/
Website Translator - http://www.prestasho...ewthread/34524/
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

#9
kennyh

    PrestaShop Apprentice

  • Members
  • PipPip
  • 171 posts
Hi tommer ,

great module ,thanks..One question: what web host would you recommend in the US

Ken

#10
tomerg3

    PrestaShop Superstar

  • US Moderators
  • 5754 posts

From 1258997661:

Hi tommer ,

great module ,thanks..One question: what web host would you recommend in the US

Ken


I use BlueHost for all the sites I own / manage.

They have 24/7 live support and offer good services.

They only offer shared hosting, so if your site is getting huge traffic, you may want to get a dedicated service, however I had no problems hosting http://www.TennisLessons.com and http://www.MathLessons.com on the same account, and they were getting around 30,000 visitors at the peak of the season.

You can Signup using http://www.bluehost.com/track/tomer
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

#11
thethreedegrees

    PrestaShop Apprentice

  • Members
  • PipPip
  • 38 posts
Hi.Thanks for this module.
Quick question..how do we know it works?:-)
Live with Prestashop
Version 1.2.5.0

#12
tomerg3

    PrestaShop Superstar

  • US Moderators
  • 5754 posts

From 1259007409:

Hi.Thanks for this module.
Quick question..how do we know it works?:-)


If you want to test it yourself, set the default shop language to something other than the country you are in.
I.E if you are in France and have French and English, set your default language in Prestashop to English.
Clean your cookies and type your domain in a new browser, it will come up in French...
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

#13
bambi

    PrestaShop Apprentice

  • Members
  • PipPip
  • 184 posts
Hi Tomerg3

Great idea but I think it does not work on my site located in Denmark yet.

Suggestion: may be you can add an option that the language can link to a currency. For example Danish is linked to DKK Swedish linked to SEK

You can check rocky's thread

http://www.prestasho...currency_module

Cheers & ThanX

Dan

:-)

#14
tomerg3

    PrestaShop Superstar

  • US Moderators
  • 5754 posts

From 1259054447:

Hi Tomerg3

Great idea but I think it does not work on my site located in Denmark yet.

Suggestion: may be you can add an option that the language can link to a currency. For example Danish is linked to DKK Swedish linked to SEK

You can check rocky's thread

http://www.prestasho...currency_module

Cheers & ThanX

Dan

:-)


The IP to Country detection is not 100% correct, it may be that the IP you were testing from was identified incorrectly.
You can PM me your site with some info and I will take a look.

I like your suggestion, I will add it to the next version.

Thanks!
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

#15
tomerg3

    PrestaShop Superstar

  • US Moderators
  • 5754 posts
Version 1.1 has just been released including:

* Better language detection.
* Browser language detection.
* Matching Currency Selection.
* Easier Installation.

P.S
I have put a lot of hours in to this, so please consider a donation.
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

#16
Star

    PrestaShop Addict

  • Members
  • PipPipPip
  • 618 posts
I am not using this module. My shop only uses English. But this module is a great module for international site. If I were using this module, I won't mind to make a donation.

#17
bambi

    PrestaShop Apprentice

  • Members
  • PipPip
  • 184 posts
Hi Tomerg3,

Great effort with the Location identifier!!!

You were lighting quick to implement my suggestion on the currencies.

I have installed V1.1 and made the changes to the header.php ; cleared the coockies and it does not seem to work on a test site I have at:

http://www.jmaya.com/JMSHOP/

I am located in Denmark - changed my default currency from DKK to NOK and default language to Norweigen. I then used

http://anonymouse.org/anonwww.html

to simulate an unknowen IP address and it does not seem to identify the IPs

Am I missing something?

ThanX again for your efforts

Regards

Dan

#18
thethreedegrees

    PrestaShop Apprentice

  • Members
  • PipPip
  • 38 posts
Hi Tomberg.

have installed the updated version from 1.0 and it was a breeze. Nice work on the code for the header:-)

Well all appears to be working and I will keep you updated on how things go, but for now I can only test it myself by changing the default language, but I will begin to ask my customers how they reach the website.

As for the suggestion of a donation from another poster, well I will offer you a discount on a product in my shop. We are here to do business right??

If you can get your head around doing a one-page checkout at a fair price you will do very well with that type of module.

All the best..
Live with Prestashop
Version 1.2.5.0

#19
tomerg3

    PrestaShop Superstar

  • US Moderators
  • 5754 posts

From 1259158457:

Hi Tomerg3,

Great effort with the Location identifier!!!

You were lighting quick to implement my suggestion on the currencies.

I have installed V1.1 and made the changes to the header.php ; cleared the coockies and it does not seem to work on a test site I have at:

http://www.jmaya.com/JMSHOP/

I am located in Denmark - changed my default currency from DKK to NOK and default language to Norweigen. I then used

http://anonymouse.org/anonwww.html

to simulate an unknowen IP address and it does not seem to identify the IPs

Am I missing something?

ThanX again for your efforts

Regards

Dan


I'm not sure where the ip you get from anonymouse.org is located, if it's not in one of the countries that you have a Prestashop translation for, then your site will open in the default language.

If you are in Denmark, and you set the default language and currency to something else, then you should be able to login from your own computer and see it in action.

Keep in mind, this module is only going to redirect to another language the first time you visit the site, so cache and cookies should be cleared (or use private mode in IE8).

It was working fine in my testing, but there is a chance there's a bug somewhere in there, I'll be more than happy to get to the bottom of it, since I like to have my modules 100% working.

Also, if you have livezilla running on your site, you can see that the users get redirected to their language page right after they land on your site.
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

#20
tomerg3

    PrestaShop Superstar

  • US Moderators
  • 5754 posts
[quote author="thethreedegrees" date="1259172245"]Hi Tomberg.

have installed the updated version from 1.0 and it was a breeze. Nice work on the code for the header:-)[/quote]

Thanks!

[quote author="thethreedegrees" date="1259172245"]Well all appears to be working and I will keep you updated on how things go, but for now I can only test it myself by changing the default language, but I will begin to ask my customers how they reach the website.[/quote]
Please do.

[quote author="thethreedegrees" date="1259172245"]As for the suggestion of a donation from another poster, well I will offer you a discount on a product in my shop. We are here to do business right??[/quote]
While I appreciate the offer (it's more than other people have offered), we're not on the same continent, so it's not going to be much help.
Even a $5 donation would be great, not so much for the money, but just to show appreciation of the product
[/quote]

[quote author="thethreedegrees" date="1259172245"]If you can get your head around doing a one-page checkout at a fair price you will do very well with that type of module.
[/quote]
I may do that after the "Occasion Reminder" module I'm working on.[/quote]
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...