I want to add an ip location greeting!

On my homepage, I’m interested in adding a script that will display the user’s city/state based upon their ip address using geolocation.



Something like…



We welcome all our customers from (city)!



If they were in New York, it would say,



We welcome all our customers from New York!



Just trying to personalize my site a little. I have tried several API scripts using Geolocation but none seem to work using CS-Cart, including:



[url]http://www.garymccaffrey.com/blog/2009/02/17/free-geo-location-script-greet-your-visitors-by-their-city/[/url]



Any suggestions?

You just need to create a new ‘Block’. From the ‘Block content’ dropdown menu choose ‘HTML block’ and put the code in the ‘Block text’ field:






Here is a sample: [url]http://www.cscartdemo.martfox.com/[/url]

Thank you so much for writing me back! Is there anyway to add this to a page or product description too? I tried to add the script through the source code of the page and it doesn’t seem to work.

Actually, even on the demo page the location is missing

geollocation information is not exact nor complete. it is hit/miss as to whether info will be retrieved or not. Obviouly it should be skipped in your script if there is no valid info returned for what you want to display.



Remember that every one of these remote calls you make adds up to slow your customer’s access to your site. So if you go putting this on every page without storing the information so it can be retrieved, you will just slow down your customer’s shopping experience.

I understand that, but according to the script if the location could not be found it would display Walnut Creek, CA, right? How come I see nothing?



The sentence ends right where the city is suppose to be displayed.



Plus, when I visit sites where a script is, they show a sample and the script works even with my browser. Does CS-Cart just not like these scripts?

Add an alert(result) to your test site where result is what comes back from the script. Check your browser error console.

How did you add the script and where? Did you clear the template cache afterward?

Greeting location is not accurate also takes ages to load…

[quote name=‘Darius’]Greeting location is not accurate also takes ages to load…[/quote]

That’s right. It depends on the location (or routing) of your ISP. That means it doesn’t show YOUR location but location of a router of your ISP.