Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Zip Code


sprank75

Recommended Posts

Hey all,

 

I got something that should be easy enough to figure out but I am just not able to grasp it. I need to validate the zip code someone has entered when getting a new account or checking out. Basically, I only want orders from the zip code XXXXX, if you try to check out or get an account with any other zip code then I want it to display a message telling them that you must live in the area to have an account or place an order.

 

Any ideas on how to do that? I am running latest OSC.

 

Thanks!

Link to comment
Share on other sites

If you made the change in create_account.php, just add the check to the code checking already there, then non one can proceed to checkout unless they can get by the login. That might make for some angry customers though if they spend an hour shopping on your cart only to find out they cannot make the purchase. You should put some very noticeable text that tells them that on every page, unless that doesn't matter to you.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

If you made the change in create_account.php, just add the check to the code checking already there, then non one can proceed to checkout unless they can get by the login. That might make for some angry customers though if they spend an hour shopping on your cart only to find out they cannot make the purchase. You should put some very noticeable text that tells them that on every page, unless that doesn't matter to you.

 

Jack

 

Thanks Jack.

 

I figured that would be the most logical place to handle it all, and I do plan to make that very clear in the site page that you must be a resident of a particular area. I am unclear as to how to add that check into the page though. I do see a couple places that looks like it is checking the zip code.

Link to comment
Share on other sites

Find this code in create_account.php

	if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
}

and add under it

	if ($postcode != 12345) {
  $error = true;

  $messageStack->add('create_account', 'You must live in the 12345 zip code to create an account.');
}

Change the zip code and text to suit your needs,of course. I haven't tested this but it should be close, at least.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...