Skip Navigation

[Resolved] locations not displaying results correctly

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 3 voices.

Last updated by Minesh 1 year, 3 months ago.

Assisted by: Minesh.

Author
Posts
#2648035

Hi,

I went through a quick location based search on my site, and I am getting incorrect results, I am wondering if someone can check the backend for me and let me know if there is a setting that is wrong/incorrect?

I am searching by zip code, and when I get the results, the results display a list of locations both in the correct zip code and completely incorrect zip code locations. Can you request a private/secure message where I can share details and access?

Thanks!

#2648195

Nigel
Supporter

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

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

Hi there

Let me set a private reply now for you to share login credentials.

Can you also give some specific examples of searches that give unexpected results?

#2648381

Nigel
Supporter

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

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

I don't know the location well enough to say whether this is working as expected or not.

To be clear, if you search with a zip code like 08701 you are not searching for results from within that zip code.

Google will return a lat/lon for the "centre" of the zip code, a specific point location, and the results will be shown based on the specified radius from that location.

When I search there I see results coming from different zip codes, but they are all clustered around NY or NJ.

If you wanted people to be able to put in a zip code and have it only show results from that zip code you would need to create a custom field to store the zip code and filter by that separately.

#2648449

So there's no way to specify with the current field that when a user inputs zip code it should return only locations in that zip code, and when a user inputs a city it should only return locations in the city, and so on for state, country etc..?

If the answer is no, can it be done with custom code on the specific field?

If the answer to that is no as well, what would be simplest way to do it like you said? I do have all addresses also saved as separate fields in the database in addition to the main single Google Address field (meaning I have 6 extra fields created just for separating the address into individual fields, and they are "Address Line 1", "Address Line 2", "City", "State", "Zip", "Country") - if this were the case, I am assuming I would need to create multiple new input fields in order to enable users to be able to search by zip, and by state, and by city etc... This sounds big so I hope there is a way to do it the first way I mentioned above 🙂

Whichever the answer is, I understand if you can't send me over an entire snippet of custom code that would be required to make this work, but would you be able to at least start me off in the direction?

Thanks!

#2648811

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I would like to clarify the things here.

There are two different kind of searches, one is already explained by Nigel that it will be the address search:
- https://toolset.com/forums/topic/locations-not-displaying-results-correctly/#post-2648381

Here is the doc for the address search:
- https://toolset.com/course-lesson/filtering-and-ordering-map-markers-by-distance/

And another search will we can say is based on the post custom fields, taxonomies (terms). Where for instance if you have a zipcode custom field that holds the zipcode value inside the database (postmeta table), then you can add this zipcode field as frontend filter where use can enter the zipcode and based on the provided zipcode it will search within the database and search for the zipcode against the provided zipcode value and display the found results.

Here is the Doc:
- https://toolset.com/course-lesson/creating-a-custom-search/

To know how those search are configured, you can always use the our free test platform http://www.discover-wp.com where we offer inbuilt reference sites build on top using Toolset features.
- https://discover-wp.com/site-templates/

You can create test site using any of the reference site we offer and you're welcome to play with that and explore how it build.

You can even install the reference sites on your local machine using the "Framework Installer" plugin":
- https://toolset.com/course-lesson/using-framework-installer-to-install-reference-sites/