Geolocation plugin doesn’t work properly

  • Posts: 47
  • Thank you received: 4
10 years 5 months ago #195242

-- HikaShop version -- : latest
-- Joomla version -- : 3.4
-- Browser(s) name and version -- : Any

Good day to you,
Geolocation plugin doesn’t work properly. I configured plugin in such way, so it shows prices in USD everywhere but Ukraine. In Ukraine prices are shown (or at least should`be seen) in UAH (Ukrainian Hryvna).
But, some of my friends and customers (from Ukraine. For example, one of their IPs is 93.183.206.171) already told me, that they see prices in USD.
Please advice something.

Attachments:
Last edit: 10 years 5 months ago by amigo.

Please Log in or Create an account to join the conversation.

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 5 months ago #195295

Hi,

I've done a test on your website and the geolocation works fine:
take.ms/la1VV
When I use a ukrainian web proxy, I see the price in UAH, and when I directly access the link (I'm based in France) I see the price in EUR.
I've also tested the IP you provided on the geoplugin website and it finds the correct country: take.ms/zxuvV
So I don't see why it wouldn't work.
Are you sure that your friends/customers are not using a proxy or VPN on their computer ? That could explain why they get the prices in another currency. It would just mean that the VPN or proxy server is located outside of Ukraine, and you can't do much about that.

Please Log in or Create an account to join the conversation.

  • Posts: 47
  • Thank you received: 4
10 years 5 months ago #195349

We checked VPN/proxy usage, no it wasn`t used.
Today one more friend said, that he sees price in dollars. His IP is 192.168.3.172, at least that`s what shows hikashop, while I check comments, left by him. But, site for IP checking indicates, that his IP is 93.183.206.171 (whatismyipaddress.com/).

Moreover, are you sure, that you see prices on our site in Euros?

Attachments:
Last edit: 10 years 5 months ago by amigo.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 5 months ago #195364

Hi,

You friend seems to be on the same network than the one where the website is hosted.
Don't really know how that's possible, but this is the more logical reason.

The IPs starting with 192.168.xx.xx are local IPs not global ones.
So the geolocation plugin can't see from where he is coming.

Moreover, are you sure, that you see prices on our site in Euros?

Yes

Last edit: 10 years 5 months ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 47
  • Thank you received: 4
10 years 5 months ago #195608

You friend seems to be on the same network than the one where the website is hosted.
Don't really know how that's possible, but this is the more logical reason.

Don`t you think that it may be a bug? Because, different srvices for IP checking in the Internet did show IP 93.183.206.171 as his IP.
Besides, he is not the one in Ukraine, who encountered prices in USD.

Yes

"Why is that? Prices should be shouwn to you in USD, shouldn't they?

And what should I do with all those geolocation problems?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 5 months ago #195638

Hi,

I looked at the plugin code and to get the user ip we call this function:

function hikashop_getIP(){
	$ip = '';
	if( !empty($_SERVER['HTTP_X_FORWARDED_FOR']) && strlen($_SERVER['HTTP_X_FORWARDED_FOR']) > 6){
		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
	}elseif( !empty($_SERVER['HTTP_CLIENT_IP']) && strlen($_SERVER['HTTP_CLIENT_IP']) > 6){
		$ip = $_SERVER['HTTP_CLIENT_IP'];
	}elseif(!empty($_SERVER['REMOTE_ADDR']) && strlen($_SERVER['REMOTE_ADDR']) > 6){
		$ip = $_SERVER['REMOTE_ADDR'];
	}

	//We add a strip tags here as the ip could definitely be modified by something...
	return strip_tags($ip);
}
So this is the common way to get the user IP thanks to PHP.

Then based on that ip, we get the zone of the user.

So if the returned IP is not correct, we take the shop zone (main zone).
You could potentially try to replace the content of the function hikashop_getIP() in "administrator/components/com_hikashop/helpers/helper.php" by another script to get the user ip, but I really think that this is the best way of doing that.

What can be tried to, is to add this code on another HikaShop view in order to see if at this place the returned ip is correct or not.
If it is correct, so the IP is edited at another place...

Please keep us informed of the results of your tests.

The following user(s) said Thank You: amigo

Please Log in or Create an account to join the conversation.

  • Posts: 47
  • Thank you received: 4
10 years 5 months ago #196833

Good day to you,
But you didn't answer why are prices shown in EUROs instead of USD.

Please Log in or Create an account to join the conversation.

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 5 months ago #196865

The prices are shown in EUR because you must have configured either the main currency as EUR or the currency of France to EUR.
If you want the prices to be in USD for France, then select that currency in that zone when you edit it via the menu System>Zones.

The following user(s) said Thank You: amigo

Please Log in or Create an account to join the conversation.

Time to create page: 0.081 seconds
Powered by Kunena Forum