Login
Register

VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

Forum

IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.

It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!

×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Can't make it work for UK postcodes 18 Mar 2013 13:40 #1

  • andypressdee
  • andypressdee's Avatar Topic Author
Here is my code:

Name=Rule for several postcodes; B1<=ZIP<=B21 OR B23<=ZIP<=B38 OR B40<=ZIP<=B40 OR B42<=ZIP<=B47 OR B62<=ZIP<=B79 OR B90<=ZIP<=B92 OR B99<=ZIP<=B99 OR CV9<=ZIP<=CV9 OR DY1<=ZIP<=DY6 OR DY8<=ZIP<=DY8 OR ST19<=ZIP<=ST19 OR WS1<=ZIP<=WS15 OR WV1<=ZIP<=WV4 OR WV6<=ZIP<=WV6 OR WV8<=ZIP<=WV14; Shipping=0.00

I am testing using the following postcode: B72 1QF but rule is not applying. Please help!

Can't make it work for UK postcodes 18 Mar 2013 17:37 #2

I have not implemented UK postcodes (or alphanumeric postcodes) yet at all, mainly because I don't really understand how postcodes in the UK work. How shall comparisons work? e.g. is B2<B10 (because 2<10) or not (because the second character '2' is larger than '1')?

Reinhold

Can't make it work for UK postcodes 23 Mar 2013 22:15 #3

I have now read up a bit about the various alphanumeric postal code systems (basically, UK, Canada, Netherlands and Argentinia).

1) The Dutch system of the form "0000 AA" is easily supported by the new ZIP4 variable (which just takes the first 4 characters of the postal code). So for conditions on Dutch postcodes, simply use something like 1000<=ZIP4<1999 (or ZIP1==1 to check whether the first digit is a 1)

2) The Canadian System has the form "A0A 0A0", where the first letter is the region, the second (digit) the city and the third (letter) the districtr. After the space is the delivery block and probably not relevant for the shipping plugin. This system has lots or things in common with the UK system, but the postcode always has this fixed form of 3+3 chars.

3) The UK system is the most complex to handle. The postcodes for the mainland have the form "A[A]0[A0] 0AA", where [A] indicates an optional letter and [AO] indicates an optional letter or digit. The part before the space is the outward code, indicating the district, while the part after the space is the inward code, which is used to deliver the mail further inside a district. Thus, for the plugin only the outward part (the "A[A]0[A0]" before the space) is relevant.

The first letter(s) describe the postcode area, while the next digit(s) describe the district within the area. I suppose for sorting and comparison we should use natural sorting, i.e. 3<12. Unfortunately, some london districts also add another letter after the digit to subdivide the districts further...

And several overseas territories use the UK postcode system, too, but have a different form, like "ASCN 1ZZ" for the ascension island. Or the british force with codes like "BFPO 801".



So my questions regarding the UK postcodes are:
  1. What are typical conditions that one wants to write with UK postcodes?
  2. Are comparisons usually just required to check the districts within an area?
  3. What parts are really needed for postcode comparisons? Would it suffice to have variables UK_Outward, UK_Area and UK_District? Would the letter in the central london districts be part of the UK_District?
  4. Shall e.g. "AB1 ..."<"SW1E ...", because AB<SW in the alphabet? Or shall the comparison simply work inside the area and compare only the district. In that case the example would not match, because AB1 and SW1E are not in the same area.
  5. Are the district numbers to be understood as a number and 3<12 (as a number), even though as an alphanumeric character 3>1?
  6. How shall overseas territories with outward parts like "ASCN" be handled with regard to area and district and comparisons with other codes?

BTW, since the UK postcodes are not numbers, one always has to write them as strings in the plugin by wrapping quotes around. E.g. (does not work yet, but the principle should be clear from this example):
   Name=Some London districts; "SW1A"<=ZIP<"SW2"; Shipping=0

Thanks for any help on those questions!

Can't make it work for UK postcodes 24 Mar 2013 01:00 #4

  • SteveW
  • SteveW's Avatar
Hmm. I'll do my best.

1: The most likely would be to try to define different delivery areas. For example, delivery within London postcodes may be at one rate, (some London based delivery firms may do this), and higher costs outside London. Also, some very distant postcodes, like on Scottish islands, may be either more expensive, or may effect delivery guarantee times.

2: Sorry, I'm unclear what this means. What may help - but may not - is that in the initial example which gave rise to this topic, andypressdee wants to separate, for example, B39. All other B** codes are in Birmingham, but B39 is Belfast, and covers the whole of Northern Ireland - which presumably costs more, takes longer, and may have different legal issues attached.

3: Apart from occasional examples like the one above, the first letter (or two letters - ie one or two alpha characters prior to the first number) defines a postal area. Typically to the UK, it is actually based on postal areas, not on population or size. But for most users, I suspect that (with a few exceptions, as in answer 2 above), the letter(s) code before the first number would probably suffice.

4: I think you are right. The postal areas do not relate to the area. So AB1 is in Aberdeen (Scotland) and SW1 is in London. So they cannot be related at all. It would be possible, I suppose, to produce a table (or series of tables) covering the whole of the UK, and based on a number of rules. I suspect that the first part of the postcode - A(A)9(9) - would be the most important part, but there could be no useful comparison between A(A) in one area and A(A) in another.

5: Yes. 3 is less than 12.

6: Sorry. I don't know about this.

I hope this helps.
Happy to help further, if I can.

SteveW

Can't make it work for UK postcodes 30 Mar 2013 23:11 #5

Thanks for the explanation. I'll see how I can best implement those in the plugin. As I'm starting a new day job on Tuesday, I can't give any estimate.

Can't make it work for UK postcodes 31 Mar 2013 23:02 #6

The latest plugin version 2.4.0 supports UK postal codes in the advanced version. If a UK postal code is detected, the following five variables are available and can be used in the conditions:
  • UK_Outward: The Outward part of the postal code (the two to five characters before the space)
  • UK_Area: The postal area (one or two letter)
  • UK_District: The postal district within the postal area (one or two digits)
  • UK_Subdistrict: The subdivision of some central London districts (a letter, or empty)
  • UK_Inward: The Inward part of the postal code (the three characters after the space)

See also the documentation .

[SOLVED] Can't make it work for UK postcodes 13 Apr 2013 17:43 #7

Problem solved.
  • Page:
  • 1