Tutorials
How to add a UK address lookup function to your OSCommerce-driven web site
Many sites are now powered by eCommerce applications such as the open-source OSCommerce. In the absence of a discrete address lookup module, Allies Computing have developed a pragmatic approach which uses the PostCoder® Web SOAP service, and has been submitted as a contribution to OSCommerce. This article outlines that contribution.
The contribution uses the address matching method in the PostCoder® Web SOAP service so not only can a Postcode be used to search for an address (overall this is the quickest method) but fragments of an address can be used to find the full address when the Postcode is unknown.
A similar, and cheaper, approach can be used to lookup street level addresses (but only from the Postcode). The user is required to complete the address manually by adding the house name/number and hence the address is not fully validated. However this approach is outside of the scope of the contribution.
OSCommerce forms
OSCommerce contains forms with address collection in the following dialogues:
- (New Customer) - Create Account - which adds the 1st entry to the customer's address book
- (Under My Account) Address Book - Add Address
- (Under My Account) Address Book - Edit Address Book Entry
- (In the Admin module) - Edit Customer
The modifications to the pages which handle addresses in OSCommerce introduce a search box in the form where previously the whole address was displayed:
A Postcode, or fragments of an address, are entered in the UK Address Search box and submitted to the PostCoder® Web SOAP service by clicking the Find Address button.
If a matching address is found, one or more addresses are returned to the screen for selection by the user:
Once the user has selected a particular premise, the usual address fields are displayed fully populated:
If only one address is matched, the address fields are displayed without the user selection step.
Non-UK addresses can be entered by using the "enter your address manually" link.
How can I try this out?
If you want to try adding UK address auto-complete to your OSCommerce application, these are the steps you need to follow:
- Unless you already have an account, register for a free trial of PostCoder® Web SOAP
- Download the latest version of the OSCommerce UK addresses lookup contribution
- Follow the instructions in the install.txt file included with the contribution
- Try out your OSCommerce application with added UK address lookup/auto-complete function!