1. sergio0187
  2. General
  3. Saturday, February 16 2019, 11:34 AM
Hi,

Is it possible to search by place and if place itself isn't found that it will give results of people around the entered place?

Kind regards
Accepted Answer
admin Accepted Answer
Admin
Hi,
unfortunately we have not tested previous changes, now I have made some modification to the code at file gmap.php and now seems to work.

$fields = array('locatie_voor_verwijslijst','locatie_2','locatie_3'); /* Change the strings alias1, alias2 and alias3 with alias of your Google map fields */
$where = array();
foreach ($fields as $f){
$where[] = '( '.$const.' * acos( cos( radians('.JFactory::getApplication()->input->get($field->alias.'_lat',null,'raw').') ) * cos( radians( b.'.$db->quoteName($f.'_lat').' ) ) * cos( radians( b.'.$db->quoteName($f.'_lng').' ) - radians('.JFactory::getApplication()->input->get($field->alias.'_lng',null,'raw').') ) + sin( radians('.JFactory::getApplication()->input->get($field->alias.'_lat',null,'raw').') ) * sin( radians( b.'.$db->quoteName($f.'_lat').' ) ) ) ) < '.$radius;
}
$query->where('('.implode(' OR ',$where).')');
  1. more than a month ago
  2. General
  3. # Permalink
admin Accepted Answer
Admin
Hi,
sorry for late reply, it's a weekend :D

Easy Profile allow you to search for locations into Google Maps fields's types, you can see an example at https://www.easy-profile.com/users-list.html (address field).

It allow you to search for users in an area around the specified address (Radius)
  1. more than a month ago
  2. General
  3. # 1
sergio0187 Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Hi,
you need to make searchable and available in search form the Google Maps field, "Plaats" seems a simple text type.
  1. more than a month ago
  2. General
  3. # 3
sergio0187 Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. General
  3. # 4
admin Accepted Answer
Admin
So do I need to change all the place text fields to Google Maps field?
No, from your user list page I can see that you already have a field of type Google Map with alias "locatie_voor_verwijslijst". You should set this field to be searchable in the your search module.

These fields already have values from users, is it possible to change this field type afterwards?
No, this is not possible.
  1. more than a month ago
  2. General
  3. # 5
sergio0187 Accepted Answer
Pro
Thanks.

Some users have 3 locations of their company. Can I have it so it can search in three location fields in one time?
  1. more than a month ago
  2. General
  3. # 6
admin Accepted Answer
Admin
Sorry this is not possible without some code change :(
  1. more than a month ago
  2. General
  3. # 7
sergio0187 Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. General
  3. # 8
admin Accepted Answer
Admin
Hi,
no problem, it is very easy for us.

In file /administrator/components/com_jsn/helpers/fields/gmap.php at line 304 replace this:
$query->where('( '.$const.' * acos( cos( radians('.JFactory::getApplication()->input->get($field->alias.'_lat',null,'raw').') ) * cos( radians( b.'.$db->quoteName($field->alias.'_lat').' ) ) * cos( radians( b.'.$db->quoteName($field->alias.'_lng').' ) - radians('.JFactory::getApplication()->input->get($field->alias.'_lng',null,'raw').') ) + sin( radians('.JFactory::getApplication()->input->get($field->alias.'_lat',null,'raw').') ) * sin( radians( b.'.$db->quoteName($field->alias.'_lat').' ) ) ) ) < '.$radius);
with this
$fields = array('alias1','alias2','alias3'); /* Change the strings alias1, alias2 and alias3 with alias of your Google map fields */
$where = array();
foreach ($fields as $f){
$where[] = '(( '.$const.' * acos( cos( radians('.JFactory::getApplication()->input->get($f.'_lat',null,'raw').') ) * cos( radians( b.'.$db->quoteName($f.'_lat').' ) ) * cos( radians( b.'.$db->quoteName($f.'_lng').' ) - radians('.JFactory::getApplication()->input->get($f.'_lng',null,'raw').') ) + sin( radians('.JFactory::getApplication()->input->get($f.'_lat',null,'raw').') ) * sin( radians( b.'.$db->quoteName($f.'_lat').' ) ) ) ) < '.$radius.')';
}
$query->where(implode(' OR ',$where));


NOTE: You need to apply this patch every Easy Profile update. This code is not tested and not supported.
  1. more than a month ago
  2. General
  3. # 9
sergio0187 Accepted Answer
Pro
  1. more than a month ago
  2. General
  3. # 10
sergio0187 Accepted Answer
Pro
And hereby the screenshots I refered to.
  1. more than a month ago
  2. General
  3. # 11
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.