Restrict checkout.pl to limited countries or IPs?

Get help with nopcart Perl, PHP or ASP checkout related issues.

Moderators: Koibito, Stefko, Randy

Restrict checkout.pl to limited countries or IPs?

Postby Histographik » Thu Dec 23, 2010 8:31 am

I would like to be able to restrict checkout.pl to one or two countries:

If you live in country X or Y the checkout.pl will proceed. If you live in country Z the checkout.pl will issue warning:

"Sorry Orders are Restricted to Countries X and Y only : Country Z is not supported."

I'm on a shared hosting plan so I can't install Perl Modules, but could this be done using my customers ENV{'REMOTE_ADDR'} and checking against a database of IP ranges (on my share hosting plan i have one MySQL Database) ?

Perhaps phpclasses might be another way of doing this?

Any help appreciated...
Histographik
WebMaster
 
Posts: 18
Joined: Sun Mar 14, 2010 2:40 am
Location: Hong Kong

Re: Restrict checkout.pl to limited countries or IPs?

Postby Koibito » Thu Dec 23, 2010 3:33 pm

Wouldn't is be easier to use a drop-down list of the countries of the world, and then prevent the customer to complete the check-out process when the country variable has a certain value? You can easily do that in JavaScript.

http://www.geekpedia.com/code54_Drop-do ... tries.html
John
Koibito
Site Admin / Guru
 
Posts: 918
Joined: Sun May 28, 2006 1:59 am
Location: New Jersey, USA

Re: Restrict checkout.pl to limited countries or IPs?

Postby Histographik » Mon Dec 27, 2010 4:31 am

Thanks Koibito, I will have a look-see and see if it will work for me.

EDIT:
Worked out well -thanks for the pointer.
Histographik
WebMaster
 
Posts: 18
Joined: Sun Mar 14, 2010 2:40 am
Location: Hong Kong


Return to Help: Perl/PHP/ASP Checkout

Who is online

Users browsing this forum: No registered users and 3 guests