Open the /frontend/class-frontend.php, and look on line 183 & 186 for the ORDER BY distance.
I will add a filter to the $sql_sort in a next update, so you can modify the ordering of the search results without having to change the core code.
Here’s the section I made changes to, but it’s not working. Did I miss something?
$sql_sort = ‘ORDER BY store ‘. $limit;
} else {
array_push( $placeholder_values, $this->check_store_filter( ‘radius’ ), $this->check_store_filter( ‘max_results’ ) );
$sql_sort = ‘HAVING distance < %d ORDER BY store LIMIT 0, %d’;
}
Here’s the website I’m trying to implement this change on:
http://www.dfwaepa.com
Thanks!
Deb
Yeah, you are right, the code I posted doesn’t work anymore in the 2.x version, sorry.
You will need to sort the returned results with the help from the wpsl_store_data filter. The field you need to sort on that contains the store name is called ‘store’, but I don’t really have time to look into how to alphabetically sort a multidimensional array at the moment.
I will have some more time for this in the next couple of days.
Ok, good to know. If you find a fix for this, let me know. I think I can smooth things over with my client if they know this will be fixed in the near future. I really don’t want to switch to a different plugin, because I’ve tried some others and think yours is the best.
Add this code the functions.php in your theme folder, and it should sort the results by store name ( at least it does on my installation 🙂 ).
You might have to clear the store locator transient cache before you see any changes. You can do this under settings -> tools, either enable debug mode while you test it, or clear the cache.
Thank you so much! That’s perfect!