Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Determine the customer country from the IP address

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 04-08-2008, 11:11 AM
 
POSDepot POSDepot is offline
 

Advanced Member
  
Join Date: Sep 2002
Posts: 52
 

Default Re: Determine the customer country from the IP address

I tried the update .. it installs properly but I am getting errors when I enable it.
I am trying to use this together with your currency module.

---------------------------------------------------------------------------------------------------------------------------------

INVALID SQL: 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET currency='USD' WHERE ip=''' at line 1
SQL QUERY FAILURE:UPDATE SET currency='USD' WHERE ip=''
Warning: Cannot modify header information - headers already sent by (output started at /home/pointofs/public_html/include/func/func.db.php:195) in /home/pointofs/public_html/include/get_language.php on line 155

------------------------------------------------------------------------------------------------------------------------

Thanks
Randy
__________________
X-Cart Gold
4.1.9
Reply With Quote
  #12  
Old 04-08-2008, 01:24 PM
 
virtual@croatia virtual@croatia is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 92
 

Default Re: Determine the customer country from the IP address

Quote:
Originally Posted by POSDepot
I tried the update .. it installs properly but I am getting errors when I enable it.
I am trying to use this together with your currency module.

---------------------------------------------------------------------------------------------------------------------------------

INVALID SQL: 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET currency='USD' WHERE ip=''' at line 1
SQL QUERY FAILURE:UPDATE SET currency='USD' WHERE ip=''
Warning: Cannot modify header information - headers already sent by (output started at /home/pointofs/public_html/include/func/func.db.php:195) in /home/pointofs/public_html/include/get_language.php on line 155

------------------------------------------------------------------------------------------------------------------------

Thanks
Randy

Really sorry, I should have tested it better. It's fixed now, just download this module again, unpack it, uninstall and install again. Unfortunately, the table ip_range will be empty after that, so you have to repeat filling data into the table.
Please, download Multicurrency modul as well, cause I've changed one file there either. No need to reinstall, just download and unpack it.

Best regard,
virtual@croatia
__________________
Check what you can do with x-cart 4.1.9:
www.smee.com

Modules I made:
IP_Ranges
Multy_Currency
Order_Dates

Modules I use:
Fancycategory
Magnifier
Survey
AOM
Reply With Quote
  #13  
Old 04-09-2008, 08:43 AM
 
POSDepot POSDepot is offline
 

Advanced Member
  
Join Date: Sep 2002
Posts: 52
 

Default Re: Determine the customer country from the IP address

Sorry but I am still getting this error after installation:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET currency='USD' WHERE ip=''' at line 1

I followed your directions (updated multi-currency etc) but still no luck.

Looking at the ip_range zip file I noticed that the skin1_original/modules/ip_range folder is empty ... is this the way it supposed to be?

Thanks for all your help.
Randy
__________________
X-Cart Gold
4.1.9
Reply With Quote
  #14  
Old 04-09-2008, 09:36 AM
 
virtual@croatia virtual@croatia is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 92
 

Default Re: Determine the customer country from the IP address

Quote:
Originally Posted by POSDepot
Sorry but I am still getting this error after installation:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET currency='USD' WHERE ip=''' at line 1

I fixed that in the last version, I don't know why are you still getting the same message, but OK, there is a way to fix it.
Open php MyAdmin and execute this:

Code:
DROP TABLE IF EXISTS xcart_stats_country_visitors; CREATE TABLE IF NOT EXISTS `xcart_stats_country_visitors` ( `date` int(11) NOT NULL default '0', `country` char(2) NOT NULL default '', `ip` char(19) NOT NULL default '', `language` char(3) default NULL, `currency` char(3) default NULL ) TYPE=MyISAM;

Everything should be OK after that.

Quote:
Originally Posted by POSDepot
Looking at the ip_range zip file I noticed that the skin1_original/modules/ip_range folder is empty ... is this the way it supposed to be?


Yes, that's how it's supposed to be.

Regards,
virtual@croatia
__________________
Check what you can do with x-cart 4.1.9:
www.smee.com

Modules I made:
IP_Ranges
Multy_Currency
Order_Dates

Modules I use:
Fancycategory
Magnifier
Survey
AOM
Reply With Quote
  #15  
Old 04-10-2008, 12:21 AM
 
Freakmode Freakmode is offline
 

X-Adept
  
Join Date: Jun 2003
Location: UK
Posts: 696
 

Default Re: Determine the customer country from the IP address

I am considering using this to show the correct currency on my site based on geo location. Does this work with UK based users on AOL as I thought they used to resolve to the USA.

Anyone in the UK confirm this has changes at all?
__________________
X-Cart 4.7.12 (Live)
Redux Template
CDSEO
Reply With Quote
  #16  
Old 04-10-2008, 01:42 AM
 
intel352 intel352 is offline
 

X-Wizard
  
Join Date: Dec 2005
Posts: 1,071
 

Default Re: Determine the customer country from the IP address

haven't tried it yet, but looks like a nice mod, esp for the multi-lingual sites. nice job
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #17  
Old 04-10-2008, 01:44 AM
 
virtual@croatia virtual@croatia is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 92
 

Default Re: Determine the customer country from the IP address

Quote:
Originally Posted by 01bodyjewellery
I am considering using this to show the correct currency on my site based on geo location. Does this work with UK based users on AOL as I thought they used to resolve to the USA.

Anyone in the UK confirm this has changes at all?

I don't remember where from I collected the ip addresses database, but if you have any of these ip addresses, I can check what the database says for it.
__________________
Check what you can do with x-cart 4.1.9:
www.smee.com

Modules I made:
IP_Ranges
Multy_Currency
Order_Dates

Modules I use:
Fancycategory
Magnifier
Survey
AOM
Reply With Quote
  #18  
Old 04-10-2008, 08:23 AM
 
virtual@croatia virtual@croatia is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 92
 

Default Re: Determine the customer country from the IP address

Quote:
Originally Posted by POSDepot
Sorry but I am still getting this error after installation:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET currency='USD' WHERE ip=''' at line 1

Solved!

The problem was that you've installed Multicurrency module before the IP_Range one and there was no way to tell the web site to switch the places of them. I've fixed it changing the line in include/data_cache.php as I explained at the top post of this thread.

Regards,
virtual@croatia
__________________
Check what you can do with x-cart 4.1.9:
www.smee.com

Modules I made:
IP_Ranges
Multy_Currency
Order_Dates

Modules I use:
Fancycategory
Magnifier
Survey
AOM
Reply With Quote
  #19  
Old 05-28-2009, 12:51 AM
 
Stizerg Stizerg is offline
 

Senior Member
  
Join Date: Apr 2008
Location: Sydney, Australia
Posts: 195
 

Default Re: Determine the customer country from the IP address

Hi guys!
This mod works very vell, but now I'm wondering how can we update the database of IPs. Here http://www.maxmind.com/app/geolitecountry you can download GeoIP database in CSV updating monthly, but how can we use it? Couldn't it be easer to make this mod compatable with maxmind's csv file?
__________________
X-Cart Gold Plus 4.6.6
A lot of custom mods
Reply With Quote
  #20  
Old 05-28-2009, 01:52 PM
 
virtual@croatia virtual@croatia is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 92
 

Default Re: Determine the customer country from the IP address

Quote:
Originally Posted by Stizerg
Hi guys!
This mod works very vell, but now I'm wondering how can we update the database of IPs. Here http://www.maxmind.com/app/geolitecountry you can download GeoIP database in CSV updating monthly, but how can we use it? Couldn't it be easer to make this mod compatable with maxmind's csv file?

It is not possible to use csv directly, what you can do is to make an sql query from the csv file, send it to me and I will update the first post in the thread. The easiest way to do that is through Excel. Open the csv file with Excel, make a formula in the last column, copy it to the end and than copy all formula cells into the Notepad. Split it into two pieces, save it as ip-range_1.sql and ip-range_2.sql, zip it and send it to the forum. I'll copy it into the first post.
__________________
Check what you can do with x-cart 4.1.9:
www.smee.com

Modules I made:
IP_Ranges
Multy_Currency
Order_Dates

Modules I use:
Fancycategory
Magnifier
Survey
AOM
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:50 PM.

   

 
X-Cart forums © 2001-2020