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.
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.
Ok, let me look into this a bit more. I will get back to you shortly.
OK, please let me know if you need any more help.
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
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.
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.
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/