Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Local Delivery mod


Recommended Posts

I just installed Local Delivery v1.0 mod


and am frustrated with trying to create a local "zone."


I have been experimenting in admin - locations/taxes - tax zones, and was successfull in getting the local delivery mod to recognize the zone OREGON, but I only want a handfull of zip codes to constitute a "local zone" to which the client can provide free "local delivery". Where do I go to define a zone? The only parameters appear to be name, code and country.


I don't use zones for taxes, since we have no sales tax in Oregon.


I think I'm missing some obvious step here...would really appreciate some advice.


(running osC v2.2 MS2)

Link to comment
Share on other sites

I hacked something like this myself...I think it was the first mod I did to my store. This is an excerpt from my create_account.php:

if ($error == false) {
//local delivery hack         
 if (($postcode>=76201)&&($postcode<=76210)){//check if $postcode is in accepted range
 $test = strtolower(str_replace(".","", $street_address));//define $test as $street_address without periods and in all lower case ("P.O. Box" becomes po box)
 if (substr_count($test, "po") == 0 && substr_count($test, "box") == 0)//does $test contain "po" and "box"?
   $zone_id = 182;//if $postcode is in range and $street_address is not a po box, set $zone_id to 182 (local delivery zone)

This checks to see if the zip code is between 76201 and 76210 - you could modify that to look for a city name or whatever you need. All zip codes within that range are accepted.


If the customer passes that test, we need to check for a po box address (can't deliver to a po box, obviously). We take the street address string and remove all periods (P.O. becomes PO) then make it all lower case (PO becomes po). If that resulting string contains both "po" and "box," then the address is rejected. This will cause problems for people who live on pobox street, but I haven't met any.


If both of these tests pass, then the customer is assigned to zone 182. I created this zone with an abbreviation of .TX and a name of Denton, Texas. All customers who live in Denton or a few surrounding towns (within the zip code range) are eligible for local delivery.


If you use this code, you need to find all places where the zone is set. I believe there are four files:





Possibly more...it's been a while since I did that. You want to insert your if statement immediately after the statement

if ($error == false) {

in each of those files.



Chris Dunning

osCommerce, Contributions Moderator Team


Please do not send me PM! I do not read or answer these often. Use the email button instead!


I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...