Distance user searching, without a postal code, in Joomla!
I wanted to be able to search my users by x Km without the need to process postal / zip codes. I achieved this in one day by incorporating some new components for mapping and searching.
My site, Smart-Love.ca, is running on Joomla and Community Builder, but the user searching was very weak. First I installed Joogle, which uses both Google Maps and Yahoo Maps to generate a longitude and latitude for any user with simple address information in CB, automaticly with a ‘geocoder’ CB plugin. Joogle then populates a Google map with that information.
I then installed ‘advanced search’, however it was too complicated for my userbase to use. So I added a couple fields into Community Builder for ‘Search Distance’, ‘Search Sex’ and ‘Online Only’. Since I now have a longitude and latitude number for every user, I quickly found a function online to calculate the distance between two pairs of decimal longitude and latitude number and result in Km. From this point if was fairly simple to run checks on my search results and on my top Avarar scroller based on the current user’s settings.
This method is better than a Postal Code method for two reasons. One, people often forget postal codes. Two, a postal code area search is very tedious and problematic to program.
This method is weak because it relies on both Google and Yahoo to work properly.
Leave a Reply
How did you make searching for â€œOnlineâ€ user ?
You just do a creative SQL statement comparing the sessions data with the users and comprofiler tables.