Cleaning Up User Input
G'day,
Something that has annoyed me for quite some time is how an increasing number of customers seem to care not a jot about how they enter their name and address details. For example, it's common for everything to be given to us in lower case. Then our email salutations etc. look a tad unprofessional.
Is there a Zen Cart plugin that helps to sanitize user input?
Some rules I'd like to have applied are...
Leading and trailing spaces are removed from all fields.
Name, company and address input is capitalised. That is, all words start with a capital letter. Yes, I know there are some names that start with lowercase letters, but they are rare.
Company and Street address should have not have punctuation, i.e no .,:; characters.
For address formatting, if there is a company name, it should be on the first line and the person's name on the second line with Attn: in from, i.e.
The Scuba Doctor
Attn: Lloyd Borrett
In the address...
P.O. Box becomes PO Box
G.P.O Box becomes GPO Box
Flat xxx, Fxxx or F xxx becomes xxx/
Unit xxx, Uxxx or U xxx becomes xxx/
Apartment xxx, App xxx, Axxx, A xxx, or Appt xxx becomes xxx/
Thoroughfares are abbreviated as follows:
Alley - Ally
Arcade - Arc
Avenue - Ave
Boulevard - Bvd
Close - Cl
Court - Ct
Crescent - Cres
Drive - Dr
Esplanade - Esp
Grove - Gr
Highway - Hwy
Lane - Lane
Parade - Pde
Place - Pl
Road - Rd
Square - Sq
Street - St
Terrace - Tce
Suburb and City are all uppercase.
Australian states and territories are abbreviated and uppercase, i.e.
Australian Capital Territory - ACT
New South Wales - NSW
Northern Territory - NT
Queensland - QLD
South Australia - SA
Victoria - VIC
Tasmania - TAS
Western Australia - WA
If country is Australia, postcode must be four digits.
If country is Australia:
Phone number should be formatted as xx xxxx xxxx
Mobile phone number should be formatted as xxxx xxx xxx
Country should be all uppercase.
AU or AUST for country, becomes AUSTRALIA.
If the country is Australia, the country in not printed as a part of the address.
If the country is not Australia, the country is printed as part of the address.
Basically, I'd like what we store and output to conform as closely as possible to the Australia Post correct addressing standards. Of course, stores with customers mostly in a different country would want to apply slightly different rules, but the basics would be pretty universal.
It would also nice to be able to run these rules over existing customer and order information in the database as well.
Best Regards, Lloyd Borrett
Zen Cart 1.5.5e, PHP 5.3.29 MySQL 5.5.42
Bookmarks