Skip Navigation

[Resolved] Cannot search by state name, only abbreviation

This support ticket is created 6 years, 4 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.

Our next available supporter will start replying to tickets in about 0.55 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 6 replies, has 2 voices.

Last updated by richardG-4 6 years, 3 months ago.

Assisted by: Beda.

Author
Posts
#956582
Screenshot_2.jpg
Screenshot_1.jpg

I am trying to: Make it so customers can search my classified rental site by state name, such as "Arizona" instead of only "Az."

I did change my parametric search settings to search by the comparison of "like" instead of "equals," and I'm still not getting the state names to come up with search results..

Link to a page where the issue can be seen: hidden link

I think this is a matter of adding some PHP that says, "Arizona = Az" (or something like that) for each state.

#957090

That does not seem to be a Toolset Maps address field, as there you can search by whatever you want, it just pulls the data from google.

If you store only the Initials, when you save that field, then you can search only by those initials.
If you insert the whole name, you may be able to get results with just partials, if you set the query to check LIKE instead of equals, but I fear that will not be what you want.

Can you let me know what field that is (Type) and how it's populated?
Depending on that I can suggest a solution eventually

The easiest probably would be to use Toolset Maps.
Is there are reason you do not use the Address field provided by it?

#957110

Yes, the field is populated by Toolset Maps on a custom content form, found here: hidden link

#957113

I am confused.

That does not seem the classic Address Field provided by Toolset Maps, but I cannot see the Form you use (it's hidden), so I am not sure.
Please see here what I mean:
https://toolset.com/documentation/user-guides/display-on-google-maps/displaying-markers-on-google-maps/#displaying-current-visitor-location

This can later be used in a Search, that is offered in the View as a Location search (by distance, is as well available):
https://toolset.com/documentation/user-guides/display-on-google-maps/displaying-markers-on-google-maps/#filtering-markers-by-distance

Can you provide me log in to this site and indicate where you edit the elements?
I will not change anything, I just want to see how it's setup and then, replicate that locally.

#957128

I may have gotten some of it figured out, at least on what you are confused about.

I saw the "distance" filter, and for some reason it is greyed out on my Home Search view, though I was able to get it to work just fine on a separate page called "Advanced Search."

The reason I can't use that filter on the Home Page Search is that it is too big, it is four rows and 3 inputs, I just need a single address search input so it fits well on the home screen search bar.

So you are correct, I didn't use the typical Toolset Map distance filter, and I'm hoping I don't need to. I'd like to be able to filter the Address field inputs, and have it include the states.

I think I could sum it up this way, and this would work too... I really like how the Distance Filter and Address Input autofill, it would be great if the Address Filter did as well!

I hope this all makes sense... Thanks again for your patience and help!

#957239

OK, I saw the setup

The field you query by is an Address Field by Toolset Maps.
The thing is, you can either query by Distance, or by the meta field (of the post).

The value saved in that field is, natively, either the Address as generated by the Google AutoSuggest when you save the post, or a set of latitude and longitude if the address doesn't exist by Google.
So that value can be either Something like "Hong Kong, Hongkong" or {23.423558814732967,120.83587639453128} - depending on what you saved.

I need, natively, to search by the EXACT value.
If I change the setting like you suggested to a LIKE, then I find "Hong Kong, Hongkong" when I search by "Hong Kong", or "Hong", but not HK.
As well, I will never find Taiwan, if I type Taiwan, as that address is actually stored in the example as {23.423558814732967,120.83587639453128}, so I would nee to search by that, to find it.

It seems to me, that on your site, Custom Code was deployed, because it deviates from the native behavior, and it seems that it is 100% intended to have the search there checking the initials already by PHP or similar.

Was this site developed by you?
I assume there is some custom code in place to make that so as it is.

For example I see that Billings, Montana, USA, is saved as Billings, MT, USA - maybe you apply something on the Toolset Form to update the field?

#1071601

Okay, so I think the best thing for me to do is to either keep using the address filter incorrectly and require an exact match, or use the Map distance filter, and just hide the elements I don't want showing up with CSS.

I can handle that, thanks for helping me figure out the correct way to display the address filter!