Hi there, I am developing a webshop and now i need to block foreign shipping addresses. What would be the best way to do this??? I was thinking about a dropdown box and when the user select a country != my_country all form input fields would be disabled. Any other thoughts?
Don't just disable the other fields, but report a message to the user (either as a message box or on the web page itself) saying that you only ship to people in country X. I think your idea to base it on the dropdown box value (presumably using Javascript) is a good one as the user should know as early as possible in the ordering process that you will not ship to him. I would additionally ensure that this dropdown box is one of the first on the page so the user doesn't waste time entering address lines etc. before finding out he can't progress with the order.
Better still put an information box on the site either in the order process or globally that says "Shipping to country name only"
I agree, better let your client know first as Jay6390 says a little information will warned them right away . . .
You could also write a script to detect region by IP address and immediately have a large message stating we do not ship outside of x country. That way the user can still browse the site but they know beforehand that you won't ship to their country. This is better than letting them get all the way to the shopping cart only to find they can't buy the product.
That is a very good idea (and for reference to the OP it's known as Geo IP). There are a few classes out there that are pre-built to see this and also a few packages that you can use (I think there's a couple in the PEAR distribution anyway)
Thanks Jay6390, I was having a brain fart and couldn't remember the term GeoIP.. lol To the OP, here's a nice tut on the topic: http://www.phpandstuff.com/articles/geoip-country-lookup-with-php