US Zip Codes

Permalink Browser Info Environment
First, some examples of setting up zones based on the first digit of US zip codes.

Address to Zone Map:

Country - equal to - United States - DomesticUSA
Postal Code - begins with - 7 - DomesticZip7
Postal Code - begins with - 6 - DomesticZip6
Postal Code - begins with - 3|4 - DomesticZip3or4
Country - equal to - United Kingdom|Spain|France|Germany|Sweden|Norway......etc - Europe
Country - default - anything - RestofWorld

Address to Zone Map (alternate way of doing it that is longer but equivalent):

Country - equal to - United States - DomesticUSA
Postal Code - begins with - 7 - DomesticZip7
Postal Code - begins with - 6 - DomesticZip6
Postal Code - begins with - 3 - DomesticZip3or4
Postal Code - begins with - 4 - DomesticZip3or4
Country - equal to - United Kingdom - Europe
Country - equal to - Spain - Europe
Country - equal to - France - Europe
Country - equal to - Germany - Europe
Country - equal to - Sweden - Europe
Country - equal to - Norway - Europe ......etc more rules for Europe
Country - default - anything - RestofWorld

Type: Discussion
Status: New
JohntheFish
View Replies:
JohntheFish replied on at Permalink Reply
JohntheFish
EDIT - NUMBER/RANGE MATCHING IS NOW INCLUDED WITH ZBS, so the example below serves as a nice example for regular expressions, but is not needed for just number ranges.

For those needing to match more complex ranges of zip codes, the shortest current (v1.5) ZBS way is to use a regex match

eg
map the following zip codes to a single zone.
13000-29499
80000-88599

Can be done with a series of separate regexes (specific details not tested):
Country - equal to - United States - Domestic USA
Postal Code - regex - ^1[3-9]{1}[0-9]{3}$ - SpecialZipZone
Postal Code - regex - ^2[0-8]{1}[0-9]{3}$ - SpecialZipZone
Postal Code - regex - ^29[0-4]{1}[0-9]{2}$ - SpecialZipZone
Postal Code - regex - ^8[0-7]{1}[0-9]{3}$ - SpecialZipZone
Postal Code - regex - ^88[0-5]{1}[0-9]{2}$ - SpecialZipZone
JohntheFish replied on at Permalink Reply
JohntheFish
EDIT - THE NUMBER/RANGE MATCHING IS NOW STANDARD WITH ZBS.

(from ZBS version 1.5)
To make life easier I have put together a number matching option with a replacement for the file /packages/jl_zonebased_shipping/libraries/zbs_rule_matching.php
This new 'number range' match is beta code.

I won't make this a formal update yet as I want the current version of ZBS to settle down first, Its only fair to existing users who don't need to be updating every few days.

With this enhancement can then do
Country - equal to - United States - Domestic USA
Postal code - number range - 13000-29499|80000-88599 - SpecialZipZone

If you want to try this beta code, please PM me an email address and I will send the file.
dmeller replied on at Permalink Reply
Is this standard now in 1.7 version?

Thanks!
JohntheFish replied on at Permalink Reply
JohntheFish
Yes, and with the latest version you can also have single numbers in a list of ranges.
eg:
10000-11000|90500-90600|90621|90677

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.