Not only is “Google” just a fun word to say, there are so many fun toys to play with over there, sometimes I just can’t help myself. I already use Gmail, Google Talk, Alerts, Calendar, Docs & Spreadsheets, Adwords & Adsense, Google Earth, Google Reader, Google Notebook, and of course Google Maps. A handy presentation on the Google Maps API by a fellow OINK-PUG member (thanks Frank Glandorf) got me thinking about what could be done with the API, especially now with geocoding readily available. And even though it is a weekend and I have about a million other things to do, I just couldn’t help myself.
So I poked and prodded around the Google Maps API for a few hours, deciding that I would write a little app for my fugitive-catching husband. Playing with the maps was fun, but what I really was interested in was the geocoding. I was able to write a handy little app that would help catch his parole absconders by providing more information than he had from his reports. (I hesitate to go into this in too great of detail because of the nature of his job… not that his “clients” know or care what Google API means, but with my luck…)
After actually completing the app for my husband, I felt empowered to tackle a problem we’ve had at the giftsforengineers.com store for a while. In January of 2006, the state of Ohio, in its infinite wisdom, decided to completely screw over all the online merchants operating from within the state. They decreed that all Ohio businesses should now collect sales tax based on the county where the goods or services were being delivered instead of based on the physical location of the business. In other words, before this new law, if I had a business located in Hamilton County, Ohio, I charged the same sales tax to everyone - whatever the Hamilton County tax rate was at the time of the sale. After this new law came into effect, I had to charge sales tax for whatever county my customer was located in. Not only do I now have to keep track of all 88 Ohio counties and their ever changing tax rates, I now have to figure out what county the customer is located in. Unfortunately, in the state of Ohio, one cannot go by zip codes alone, as zip codes span more than county. Attempts to integrate the Ohio Department of Taxation address/county database with our current system proved to be a monumental task, so we resorted to simply asking the customer to provide us with their county name and doing a quick lookup from that.
The problem comes in however, when a customer is buying a gift for another person, and having it delivered straight to the recipient. Many times they don’t know the recipient’s county, and thus the incorrect sales tax could be charged. Obviously our current system was not foolproof. Now, thanks to Google’s super-easy geocoding, I solved this problem with about 10 lines of code. My code now automatically looks up the county and the charges the applicable tax based on the customer’s delivery address.
I also took some time to play with the Google Custom Search Engine. I created a search engine for PHP Articles and Tutorials, but I only included the top 20 PHP resources for these. (Top 20 in my humble opinion, anyway). So now if I’m looking to increase my knowledge on a particular topic, but I don’t necessarily want to see millions of threads about it in PHP forums or anywhere else, I can do a quick search of just the sites I want. Although I’ll be tweaking this in the next few days, anybody’s welcome to use Elizabeth’s PHP Article Search. (Feel free to make fun of the awesome undesign of the site, you won’t hurt my feelings.)