View Full Version : Sort by distance rather than zipcode?!
October 11th, 2009, 06:25 AM
Sorting adverts in a category by zipcode might make more sense in America, I'm not sure, I don't know how the American zipcode works, but it seems sorting by zipcode is useless, and that sorting by the distance would be far more helpful.
October 11th, 2009, 07:08 AM
No easy way off the top of my head to do that. A sort is done on a field in the same table as the information is held. Distance is calculated for each individual result when the query is being printed after the sort by other queries.
October 20th, 2009, 08:19 AM
So the sort by zipcode is pretty much useless?
October 20th, 2009, 08:30 AM
well accordingly to you I guess. I dont think so but thats just me.
November 16th, 2009, 02:10 PM
If only classifieds would sort by distance, I would come back to using this app. It is an absolute requirement for me.
What can we do as users to get this into the app? I did it myself one time a few years ago on this application but of course had to abandon it because of the upgrade process. But, it's definitely do-able--by revisiting the code structure of the sorting and making sure that lat and long are in the record.
Is it possible to fund the development? Perhaps those of us who need it could kick in to get it done? This one capability is so vitally important. A zip code sort really is useless. I need to be able to provide a list of items sorted by "distance from me." This feature is a big deal for many locally-driven sites--which is a HUGE market.
Please let us know what it would take to get this added. OR are there hooks enough in the current version to allow a third-party add-on? I don't know. Thanks for your consideration.
November 16th, 2009, 04:08 PM
well if you remember what you did let me know. The only sorts I know of off hand is mysql fields sorting by those.
November 16th, 2009, 05:06 PM
I no longer have the site where I had the distance sorted. It was quite a while ago. And I had so many hacks added to the site (my early web days) that it was woefully out of date before I ever launched it, so gave up! (edit to add: I think I had stored the information in related arrays and used those to sort, which meant a fair amount of hacking of core code.)
But I do have this site still--which is ancient and buggy and on the block for an overhaul:
Guinea Pig Home Listings - Adoptables (http://www.guineapighome.com/listings/showcat.php/cat/4)
It's an OLD version of classifieds and a very hacked vB to accommodate my needs.
In this site, I use the LAT/LON fields to get the distance and display it and I allow the user to limit the search to "X" miles or KMs from their location. So, it sort of works, but not really well enough (lists the distance but doesn't sort). Plus it's buggy (my issues) and I can't upgrade it.
I was planning on ditching the vB/PP solution for Joomla/SOBI2 because there is a SOBI2 addon that does a distance search. But, I really don't want to go that route. I did do an initial install of the solution for a different site (with the same basic needs) and while the distance search is fine, it's just too much work to get the overall look and other functionality I need.
But as you can see, here is a perfect example of a need for "Distance from Me" and not just for the US. It's about getting animals adopted out. People don't like to travel very far AND they can be lazy. You have to make it as easy as possible for them. It's just one example--and to me, it's about saving lives, so it's very important.
To me, a viable solution needs to be international, which I think means using a Google API to get Lat and Lon on both the permanent address of the listing and the reader's location and going from there. Relying on a zip code database is too limiting.
There are other internet apps out there that do provide 'distance from me' searches. If it would help to track some of those down for analysis and feasibility, I'm more than happy to help.
November 16th, 2009, 06:37 PM
If Classifieds search was changed to use temp table records like Photopost it would be much easier.
The search records could then store the distance in a field and this could be sorted on. Would just need the distance calculation done in mySQL at run time on the first search.
The other way of course would be to run the calculation on *every* search / category view. Though this might be quite costly, I'm not sure how much CPU time that would take. The benefit though would be it could be used on category viewings too, not just searches.
vBulletin® v3.8.1, Copyright ©2000-2014, Jelsoft Enterprises Ltd.