Address Attribute: breaking the postcode in 2 parts

Permalink
Hi
We are curently developping a website where people are redirected to specific areas on the website depending on their postcode.

As in the uk, postcodes are made of 2 parts, and the test to redirect is done on the firstpart, we need to break the postcode field in 2 parts (the first part being of different length...)

i'm checking the /models/attribute/types/address folder and files, but not sure where i can actually do it?

i feel i have to update the different functions with the 2 postcodes fields, but where do i actually create it at the first place?

 
WebcentricLtd replied on at Permalink Best Answer Reply
if I've misunderstood or the approach is not possible then please ignore as appropriate.

Personally, rather than change the C5 code I'd first investigate adding a function to my own code to either:

explode the postal code based on the space seperator and use the first part (in UK the postal district) or if the person registered without putting a space in the postal code I'd remove the final 3 characters from the postal code giving me the postcode district of either 2,3 or 4 characters.

Of course if the postcodes are markedly different from UK ones then this approach might not work. I'll let someone else comment on reqwriting the core C5 address attribute as that seems like quite a bit of work.
epurple replied on at Permalink Reply
perfect
dont know why i havent thought about it.
it works fine for UK postcode, but as you said, wouldnt if the postcode is not using the uk format