Skip Navigation

[Resolved] Regarding custom search

This support ticket is created 3 years, 3 months ago. 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.

This topic contains 2 replies, has 2 voices.

Last updated by ericF-5 3 years, 3 months ago.

Author
Posts
#2187339

Hello,

We are trying to store the address components in post meta, for which I have used the custom field Address of toolset. We will like to have a feature that will filter my stores in my state city or use my current location. We have implemented the following part.

-> hidden link

From here, the store can be searched. Currently, I can have only one search field which accepts all states, cities, country.

I will like to have features like where users can search based on current location or country and city dropdown ( hidden link ). Can this be possible with the toolset? If yes, can you please provide the way to achieve that?

-> hidden link

Here is a search result that will display the map with the marker of store location and store listing

Thanks.

#2187497

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

When you add an address field it stores a text form of the address and its coordinates, and those coordinates are used when adding a distance filter (e.g. show results within 5km of some address or the current user location). The text form of the address is only really used for display purposes.

So it isn't possible to have a drill-down approach where you select a country then a state then a city etc. using the address field.

For that you would need to store such data in parallel.

The recommended way to do this is through post relationships. You set up post types for country, state, and city, and then connect those in one-to-many relationships, and for the final part of the chain you connect city to the post type your users will be searching, again in a one-to-many relationship.

Then in the search section for the View you add a relationship filter for the city, and then the other ancestors, so that on the front end your users will be presented with dropdowns for each part of the chain (i.e. they choose a country, then a state, then the city).

#2188461

My issue is resolved now. Thank you!