Skip Navigation

[Résolu] Distance Search in parametric search

This support ticket is created Il y a 8 années et 6 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

Marqué : 

This topic contains 4 réponses, has 4 voix.

Last updated by leeF-2 Il y a 8 années et 6 mois.

Assisted by: Waqas.

Auteur
Publications
#304595

Lee

I am setting up a classifieds website using your classifieds template, and I need to include a distance search field in the Views parametric search. Is there a way of doing this?

And from a search point of view, I would like the search field to be auto populated by the user's location if they click on a current location button next to the field, is this also possible?

I know WordPress posts can be plotted on a map but I don't know how to use that location to set up a distance search (Within XXXmiles).

Also, Is there a way of plotting WordPress posts on a Google map by the user just entering their postcode in the front end CRED Ad submission form, rather than entering the latitude and longitude?

Thanks,
Lee.

#304791

Waqas
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Unfortunately, there's no built in or easy way of doing this. Because Views Google Maps integration only works around lat/lon data.

However, you can extend the features based on the latitude and longitude stored in the custom fields. You will need to calculate the distance, apply logics, alter the main query and grab the results. Generally, this requires lot of custom coding, in addition to, understanding how all this works.

There are some good articles and discussions available on internet, a few are listed below for your reference:

- hidden link
- http://stackoverflow.com/questions/4190154/given-coordinates-how-do-i-get-all-the-zip-codes-within-a-10-mile-radius
- http://stackoverflow.com/questions/4749706/lookup-city-and-state-by-zip-google-geocode-api

For a help on how you can alter the main query of Views (i.e. adding/modifying the search attributes on fly), please see https://toolset.com/documentation/user-guides/views-filters/

For an understanding about getting current location of the user, please see:

- hidden link
- hidden link
- http://stackoverflow.com/questions/2577305/how-to-get-gps-location-from-the-web-browser

In short, the solution you are looking for, requires some research to gather the building blocks. And then implementing within the WordPress system scope. As well as, extending the plugins or PHP Code accordingly.

We also offer a custom coding service for our Toolset Clients, where we build custom solutions (like this) on top of Toolset Plugins. Please see hidden link for more information.

#304822

Lee

Okay, Ill take a look at the sites you have provided. Thanks for you help.

Lee.

#316590

Hi Lee,

Did you succeed in doing this?

Cheers

Joff

#512858

I'm also curious if there is a successful implementation of this.

Thanks

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.