Skip Navigation

[Resolved] How to make distance view not always required?

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

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 7 replies, has 3 voices.

Last updated by brianD-10 6 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#1164089

I have included a distance search parameter in my view using this code:

[wpv-control-distance compare_field="sitters-postal-code" distance_center_url_param="toolset_maps_distance_center" distance_radius_url_param="toolset_maps_distance_radius" distance_unit_url_param="toolset_maps_distance_unit"]

How do I make it so that someone can do a search with or without the location field filled out?

Right now the only way to execute a search is to fill out a location.

I would prefer that if the user doesn't include a location, then the search ignores the distance compare parameter.

#1165417

That does not work, logically, since if you want to search by the distance you need a centre, and if you query by distance, that is the only parameter available in that query, hence, it is always required to pass.

However, if you add any other search to that search filter like a query for taxonomies, you can, of course, submit that search, without needing to pass a location.
You can see an example here: hidden link

It has a distance search and many other searches. Distance is not required to be passed if you do not search by it.
You can press on any other filter (top icons) and see them working, without passing any distance.

#1168896

Ok, let me look into this a bit more. I will get back to you shortly.

#1169442

OK, please let me know if you need any more help.

#1169749

Hi Beda.

I'm still having issues. On my search, I have many filters, but it always requires me to fill out the location. You can try it for yourself here: hidden link

In the example you gave me, there's no search filters. See screenshot here: hidden link

#1170326

Well, the search on the example is the greenish icons on top and the location search is within the map just below/right to the "Name or Description" search, click the crosshair

However, the difference here is that you have a submit button, on the example, I shared AJAX is used on input change.
With that setting you won't be required to add value there if you have a submit button, then yes.
The setting is "AJAX results update when visitors change any filter values"

I am consulting with the Developers if this is expected and if not escalating it as a BUG, if yes, I'll suggest you file a request in a new form, where our Product Management will be aware of this.

#1170467

We will file this to add as an improvement to Toolset Maps.

The developers will decide upon the best way to make this, however I think it will be bound to whether or not you have other filters in the search

We can close this ticket if you have no further questions in regard.

#1173606

I am also requesting that you fix this. Location should not be required if other filters are present.

This thread has a temporary workaround: https://toolset.com/forums/topic/address-filter-not-a-required-field/