intro
this is not a module or Addon but a hack of the SobiPro Search Core
requirements:
a geo-field in the section with geo data (min. geohash, better lat-lon + geohash)
you can switch the search / result units (km / miles)
the search with the selectable distance is done based on
an entered city (or ZIP) or even by the city based on an entered entry ID
requirements
what we need:
1. geo fields in your sobipro section fields manager
you must add/edit the geohash data of the item's addresses
get the geohash data from geohash.org with the lat-lon data of the address
for each item there must be a geohash value (i will add a script to fill these values)
2. additionally I have a script to fill these data for new entries
howto - setup
after replacing the general.xlm (administrator/components/com_sobipro/config/general.xlm)
you will find setup entries in your sobipro configuration.
go to your section configuartion and choose the search tab within the template tab
optionally (if you don't want to update the general.xlm),
you can enter all necessary values manually in the search.php files (values in both files)
here you will see:
1. important: enable the radius search
2. choose the distance unit (km or miles) you want to use
3. select the geodata service (opencagedata, locationiq or nomantim)
opencagedata and locationiq require a free api-key, without key only nominatim can be used.
I recommend opencagedata, because they send the needed geohash with the json data.
4. a field where you can/must enter your geodata service api-key
5. select the field name where the city names are stored
6. select the field name where the geohash data is stored
7. choose if you want to activate the search option by Zip/PLZ (5digit us or germany only)
usage
there are 2 main files which must be updated for the radius search to run.
both files are named search.php
the first is located in components/com_sobipro/lib/ctrl/search.php (this is the main search script)
the 2nd in components/com_sobipro/lib/views/search.php (it generates the data for the view.xsl)
you can just replace the files or edit them manually as you can see in the edit_search.php file
there is also an edited search.js javascript file not needed for the search to work
(located somewhere in your com_sobipro/usr/templates/your-template/js folder)
replace the file or edit the few lines manually - it's just for the input field and mixed radius/extended view
finally we have to edit (replace) the xsl-files in your used com_sobipro/usr/templates directory
1. important is the view.xsl in the (template)/search folder which gives us the input field for the radius search
2. (only if you want) the vcard.xsl in the (template)/common folder for distance-display in result vcards.
remember: you can also edit the *.xsl files direct in the sobipro backend
I have added some language *ini files which you must add to the sobipro.ini files (admin and site!),
a radius.css file with some formating lines (add it to your sobipro/template.css) and the radius icon
summary
when you have setup and running the radius search with the needed geohash field
I recommend you can also use the sobipro_nearby module (which also needs geohash).
It is just a little modul, which shows (only in detailed view) the most nearest entries to the active one.
(number and distance is selectable)