Skip Navigation

[Resolved] AJAX Search does not update filter values

This support ticket is created 6 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 1 reply, has 2 voices.

Last updated by Beda 6 years, 3 months ago.

Author
Posts
#1113034

Joe

We have a site that searches custom post types by a couple different parameters. The search used to be button driven. The user would set their options click search and get the results. We updated the page to use the AJAX search capability. Now, when a user changes any one of the filter values, the search results update. However, the filters do not update to reflect the valid options for the search results.

For example, there are two drop downs: Resource Type and Keywords. When you change either, the search results update; however, the options in the filters stay the same including their resource counts.

To demo this, go to hidden link and click on the one of the blue resource type icons half way down the page (Funding, Projects & Reports, etc.). This takes you to the search page filtered for the type. As you change the various drop downs on the left side, none of the options in the other filters change. They are all based on the original search.

Is it possible to have the Ajax results update the filter options as well? This would match what happens when you have a search driven by a search button. Thanks,
Joe

#1113472
Bildschirmfoto 2018-09-22 um 14.40.26.png

That should be possible, yes, if you head to the View you created, in the "Custom Search Settings", you should select "Let me choose individual settings manually".

Then, set the settings as I did in the ScreenShot attached.
That will make it so that the results update on change of the inputs, and the inputs as well update when results update.
I chose "Update URLs after loading search results", but that one is up to what you prefer.
Important for your goal is "Show only available options for each input".

That does produce the exact search input behaviour you are looking for, right?