Jump to content

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


Recommended Posts

@kennyh - I came from Polnad and I got the page in English even you have Polish installed. So, it doesn't really work - at least for polish.

And I have the same problem - I did many tests but I can'y find where the problem is.

Let's say I have 4 naguages installed - english, french, spanish and polish.
The default langnguage and currency is set to English and USD.

When I visit the page from france - frech language and EUR are loaded correctly,
when I open the page from spain, also spanish and EUR are loaded as well, it's nice.
But, the problem is, that when I open the page from Poland, English language and polish currency (PLN) are loaded.

So it seems that the module detects country as Poland correctly (it loads PLN as currency) but can't find polish language installed in prestashop, then it loads default english instead.

Then I set up polish as default language, and then the module loads polish language correctly (probably it can't find polish language istalled, so it loads polish as default) - and in this case it has no problem to find the language files... And that I can't understand. I serarched for uppercase - lowercase problem in the database and prestashop files, i tried to find something in locationdetection.php, unfortunately with no results :(

Could you help me, please? :)

Share this post


Link to post
Share on other sites
  • 1 month later...

Hi,

I'm trying to add a small feature:

Once we have the database ip2country installed, we can fill customer country with this data? How can we auto fill country detected from their ip?

Thanks

Mozack

Share this post


Link to post
Share on other sites

Hi ,
first of all thanks for this contribution

I downloaded it and tested it on both prestashop 1.2.5 and 1.3.1
In 1.2.5 the page is redirecting infinitely i have read that it worked for some people here , is there anything else to be changed, i did as indicated in the install video and read the instructions provided but with no success.
In 1.3.1 it is always taking me to the default language
my preferences are as follow, maybe i am doing something wrong
Language redirect = active
Options = Browser Language Detection First
Currency redirect = active
Language and currency link = active

English = Dollar,
Portuguese = Yen,
Japanese = Yen


thanks for any help


regards

Hugh

Share this post


Link to post
Share on other sites

Hi Hugh,

May be try setting "IP Address to Country Detection First". You would need someone with an IP out side of your country to test and see if it really works.

Hope this helps

Dan

Share this post


Link to post
Share on other sites

Hi,
thanks for your reply

The reason that I set the Browser detection first is that we offer our products only in our country , We are one of a few companies selling products for foreigners in this country ( Japan ) , we have customer who speak portuguese , spanish , english and of course japanese and most of then have their software in their own language, so that s the only thing we can rely on since obviously the ip belongs only to Japan.

regards

Hugh

Share this post


Link to post
Share on other sites

Hi,

This is a nice module, i think everything is working fine here with this module. But, i want to use it for other features and i dont know if it is possible.

I want to show in tpl files some different messages based in country. How can i print the country name in some tpl file? Ex.:

{if country_iso_code == PT}we ship to {$country_name} with the following options:

{else}we ship to {$country_name} with the following options:{/if}

Can that be done using the module variables? Or we must have a new instalation of ip2country script?

Thanks

Mozack

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Hi Tomerg,

i found and installed your language detection module. I did configure it but for some strange reason its not working for me... my shop url is:

i did set the Default language to EN in the config of the module. And now when i open the shop it just gives me english language in stead of german. Im from germany and use german mozilla... i dont understand this.

Do you know where could be the problem or what i could check?

I think the module is not compatible with 1.3.1.1 could you please make a update Tomerg? I would not mind to pay for it...

many many thanks!!

Share this post


Link to post
Share on other sites

Hello Tomer,

i did install a new Prestashop again and did install the latest version of your Location Detection but it is still not working fine for me… im from Germany and when i Visit the Shop it gives me the English Language and Dollar currency even though i did set the option in your module that the currency for England should be pounds. When i click on the England flag manually it puts the currency to pounds…

Your module is giving me the same results no matter if i use the “IP Address to Country detection first” or the “Browser Language Detection First”. I did check it in latest Mozilla browser and Internet Explorer same result…

Of course i did also do the PHP changes to the header.php as described… i did create a screenshot of the modules settings please check it: http://www.abload.de/img/locationdetection_sett2t88.jpg

My shop url is: can you please tell me where the mistake might be? I dont understand why this is not working.... i realy want your module to be working and i would also like to pay you for it…

Many thanks, chris

Share this post


Link to post
Share on other sites

Tomerg, can you please help me to get the Location Detection working on my site? When i visit your site its working fine but on my site its not working fine... i want to pay you to get the module working on my site i realy need this module its very important for me so im ready to pay you!! and i also want to buy your Attributes Wizard Pro module and maybe a few other modules but i need better support from you... please get back to me. THANKS!!

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Hi,

I have another question about this module.

Is possible to do not redirect some crawl agents? I have facebook app integrated but when it visit my website facebook is redirected and sometimes show 404 error in product image.

Regards

Mozack

Share this post


Link to post
Share on other sites
Hi,

I have another question about this module.

Is possible to do not redirect some crawl agents? I have facebook app integrated but when it visit my website facebook is redirected and sometimes show 404 error in product image.

Regards

Mozack


I am disabling the redirection for the most common crawlers (using the "user agent"), you can add any other keywords there which will disable the redirection

       // Search Engine or Crawler
       if (stripos($_SERVER['HTTP_USER_AGENT'],'bot') !== false ||
           stripos($_SERVER['HTTP_USER_AGENT'],'baidu') !== false ||
           stripos($_SERVER['HTTP_USER_AGENT'],'spider') !== false ||
           stripos($_SERVER['HTTP_USER_AGENT'],'Ask Jeeves') !== false ||
           stripos($_SERVER['HTTP_USER_AGENT'],'slurp') !== false ||
           stripos($_SERVER['HTTP_USER_AGENT'],'crawl') !== false)
           return;

You can add another line in the middle there as

           stripos($_SERVER['HTTP_USER_AGENT'],'facebook agent string') !== false ||

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Good morning,
I well have like the principle of currency by location I have download module and instal however when I header.php puts in the file line that to ask you for the installation for my site bug???
being can I have an error somewhere are possible point out to you to me?
I put as ca.

require_once (dirname (__ GOES OFF __). ' / init.php');
include_once (_PS_MODULE_DIR_. '/locationdetection / locationdetection.php');
$ LocationDetection = LocationDetection new ();
$ LocationDetection-> redirect_user ();

of that I puts line this my site dispear completely?
could you please help me ?

Share this post


Link to post
Share on other sites
  • 3 weeks later...

Hi. Ive installed on my site, www.catalogo-onlinersi.com.ar and works fine to my country. If anyone can test, i appreciate.
And for tomerg3, You have tested if this module affect the google search ?

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Does anyone else then presto-changeo website got this working?

I notice the http://www.presto-changeo.com give me the page in German since I set the language in IE to German. but my own webpage don`t change.. and the http://www.catalogo-onlinersi.com.ar site open in english also.. So does not redirect to German.

I added the code and don`t have any error messages on the page.

34788_k9b4tXnYxYntjAe8G3Dv_t

Share this post


Link to post
Share on other sites

I got it to work now. I pasted the code one more time in the header.php and uploaded it one time more. And suddenly it works now.

Only thing not working are when I put IE to Taiwan language. zh-TW. This would not have the language change automatic.

Maybe because the language code in IE and Prestashop are different?.. Prestashop have TW isocode, while IE have zh-TW

Share this post


Link to post
Share on other sites

It would be great to have an option like Currency where you could tell it to translate into one language when so and so settings are set in the browser.

Like that I could put all chinese and taiwan language settings in a browser and make that = Chinese traditional

also to have different variations of Norwegian.. like Norwegian Bokmål and Nynorsk in browser settings = Norwegian.

It would let the translation part set itself after browser languages instead of IP address. It would be a lot better since you could have French people living in other countries and having a French language settings on his computer, but having an IP address from US or other country.

Share this post


Link to post
Share on other sites
  • 1 month later...

Hi

Despite reading all nine pages of this thread I am still at a loss with my particular problem. (this could be along post)

Some background:

- Prestashop v 1.2.5
- Location Detection module v 1.5.1
- Php 5.2
- English (english) EN installed
- Deutsch DE installed
- Main currency set to GBP in BO, but also have USD and EUR configured
- Language Currency link is off
- Use the IP location details first is selected (not detect from browser)
- Redirect Currency and Redirect Language are both on.

I have done the following:

- Installed the module (1.5.1) and uploaded the latest location info to phpmyadmin all ok.
- Checked the table _iptoc and all looks ok, over 3000 pages of data.
- Every time I check the currency/language I completely reset all settings in Safari, including cache.

I think there could be a problem as PS identifies the english language as EN. But the _iptoc table identifies the United Kingdom as GB in the 2 letter and GBR in the 3 letter.

Q1: Should the entry in the 'United Kingdom' field in the module config show GB (as the country code in the _iptoc table) or EN (as the english language ISO code installed in PS)?

But what actually happens is this: From my PC in the UK the language I see is always EN, even if I set the 'United Kingdom' language to EN or DE (remember DE is installed). The language does not even follow the default drop down.

The currency displayed is always the same as the setting in the module labelled default. So it does not matter if I change the currency under 'United Kingdom' to EUR or GBP it always follows the default when not available setting. Changing the PS BO default currency has no effect on anything.

Am i completely missing something here. I have tried from various 3G phones/ other locations and the same happens. Also tested from server in Netherlands. Still follows default. The module is obviously having an effect on prestashop.

I will happily donate if I can get this working. Can anyone see any error in my methods? Thanks in advance for your help.

Thanks

Dave

Share this post


Link to post
Share on other sites
  • 2 weeks later...
  • 1 month later...

yes it's great for us selling products around the world. It's nice that it's free, but considering its value, I think it should be added to your paid for modules Tomer :-)

Eagerly awaiting the 1.4 update now.

Peter

Share this post


Link to post
Share on other sites
  • 2 weeks later...

I am waiting for the update of this module too !

A nice new feature would be to detect the country and to adapt the picing with or without VAT depending on the country (example, VAT included within EEC, VAT excluded out of EEC).

Eric

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Hi Tomer,

I would like to get the new module. However, I installed the old module in a V1.4 Prestashop and as I read later, it is not working. The problem however is that it is causing some problems and I cannot remove it again. Could you help me how to remove it, so I can get the new module?

best regards
Stefan

www.zapry.com

Share this post


Link to post
Share on other sites
  • 4 weeks later...
  • 4 months later...
  • 2 months later...

Thanks for this great module. I have now installed and is running on our live site: www.lostinsummer.com however I have set the US site to auto set in USD $ and English, but it seems to still be defaulting to UK Pounds instead of dollars for US visitors. Can anyone tell me why this is happening? Thanks.

 

Thanks for this great module. I have now installed and is running on our live site: www.lostinsummer.com however I have set the US site to auto set in USD $ and English, but it seems to still be defaulting to UK Pounds instead of dollars for US visitors. Can anyone tell me why this is happening? Thanks.

Share this post


Link to post
Share on other sites
  • 1 month later...

I must appreciate your efforts.........But i hv one query.....if my store's default language is English but default currency is INR then how will it work?

 

Thanks in advance!!!

 

 

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.

Share this post


Link to post
Share on other sites
  • 4 weeks later...

Maybe some stupid question, but is it compatible with 1.4.7.0?

 

I just installed it (disable currency and enabled browser detection first), but I just realized the code in header.php has changed. In the istructions:

 

The database table with the IP address to Country information has been installed.

 

* Add the following code to /header.php below "require_once(dirname(__FILE__).'/init.php');" (Line #7)

 

 

include_once(_PS_MODULE_DIR_.'/locationdetection/locationdetection.php');

$locationDetection = new LocationDetection();

$locationDetection->redirect_user();

 

However the header.php now looks:

$controller = new FrontController();
$controller->displayHeader();

 

 

Tried this, but it seems is not redirecting. Any idea?

$controller = new FrontController();
include_once(_PS_MODULE_DIR_.'/locationdetection/locationdetection.php');
$locationDetection = new LocationDetection();
$locationDetection->redirect_user();
$controller->displayHeader();

 

Finally, using browser detection, if a language like CA (country should be ES, but it has more than one language, so is OK ES-ES) has not an associated country is it going to work? I have EN,ES and CA

 

Thanks in advance

Share this post


Link to post
Share on other sites
  • 3 months later...
  • 3 weeks later...

I've enabled the ERROR DISPLAY and i see this error:

Fatal error: Cannot redeclare class FrontController in /web/htdocs/www.pppppppppp.com/home/override/classes/FrontController.php on line 16

 

If i don't upload the frontcontroller.php file, when i click on CONFIGURE in module section i look only this text:

 

This module allows to switch the default language and currency ( if installed ) according to the country visitor.

Search Bots transparently.

 

 

where im wrong?

thanks a lot

Edited by polparo (see edit history)

Share this post


Link to post
Share on other sites

You have some bug in FrontController

OK, try another way.

Remove my FrontController from override

edit /classes/FrontController.php

add

in function run()

Module::hookExec('beforeInit');

before

$this->init();

like this

 

public function run()

{

Module::hookExec('beforeInit'); //<- add this line

$this->init();

$this->preProcess();

...................

...................

 

You remember, module working only if cookie not create yet.

 

Testing procedure:

In ip4location, uncomment 77 line and remove cookie from browser.

This set english language and pound currency if installed.

You can try IP address from another country.

 

Kind regards

 

PS

In module is nothing to configure.

Edited by @mario (see edit history)

Share this post


Link to post
Share on other sites
  • 2 months later...
  • 2 weeks later...
  • 2 weeks later...
  • 3 months later...

Can you make a small edit in this module ? Please

I want a module which can detect the customers ip and can show a announcement bar on the top of page saying -" Yes we ship to that ip's country " like usa,england, france etc.

and the bar is like hello bar.

  • Like 1

Share this post


Link to post
Share on other sites

Is there any way to modify the module to make the default postage change to the users countries postage ? For instance on my site UK is the default postage, I tried a Russian IP address and the postage still shows up as UK, could this module be made to change to the carrier that matches their country ? Or perhaps it already does ?

Share this post


Link to post
Share on other sites
  • 1 month later...
  • 1 month later...
  • 4 weeks later...
  • 3 months later...
  • 1 month later...
  • 2 months later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More