Support » Plugin: WP Store Locator » Filter By Cities

  • I am displaying different schools using the store locator plugin. I have integrated web service for displaying the cities. Currently all schools are being filtered based on the cities. The problem i am facing that is it is displaying other cities schools as well. Actually what i want is to display schools only in that specific city for which the user has searched. The problem i think is due to the radius. If i use a big radius all schools of that country are returned is that possible that i can filter the results based on the city before displaying them on map. Looking forward to your response.

    Kind Regards,
    Sameer

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Can you please also tell me which function is displaying markers on the map in plugin files. I found search_store function but i am not sure.

    Plugin Author Tijmen Smit

    (@tijmensmit)

    This is the function that makes the search in the db for locations that fall within the set search radius.

    What you want can work, but the normal search only send the coordinates back to the backend, not the searched value.

    So what you need to do is first reverse geocode the returned coordinates ( how to include the server key params is shown here. ), from the results the API returns filter out the city value. Then use the wpsl_sql filter, and the wpsl_sql_placeholder filter to adjust the SQL query so that it only returns locations from the matching city.

    Hi Tijmen,

    I have read what you have wrote can you please tell me is there any function which returns the searched lat long of the location which i can use for reverse geocoding. The filters will help us to modify the query but other work needs to be done in the plugin files or is there any safe way of doing this customization. Since direct customization will lost our changes when we update the plugin. Looking forward to your response.

    Thanks,

    If there is any filter or hook which can give us the long and lat of the searched location that will i think prevent direct customization in the plugin files. Thank you once again for your help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Filter By Cities’ is closed to new replies.