hey,
i asked this before but didn't quite get an answer:
I'm building a recipe site, and search is by custom taxonomy "ingredient". the relationship in the search form is "all values", as i want to show only recipes with all ingredients chosen (in checkboxes).
however, sometimes the user can pick a few ingredients and get no results, and not know which ingredient is "jamming" the search.
so i want to be able to give him ALMOST accurate results. for example show recipes with only 3 ingredients from the 4 he checked, and if possible list somewhere the 1 ingredient which is missing.
at first i was thinking of creating a different search view (category maybe?) and placing it instead of the "no results" text. but that didn't work.
any ideas?
thanks!
Ido
so i want to be able to give him ALMOST accurate results. for example show recipes with only 3 ingredients from the 4 he checked, and if possible list somewhere the 1 ingredient which is missing.
The "missing" ingredients list would require some more advanced custom code, but the "only show available inputs" advanced custom search option might be a useful alternative. See our document here:
https://toolset.com/documentation/user-guides/front-page-filters/advanced-settings-custom-search/
When you choose this advanced search setting, the search filter options will update any time the user makes a filter selection. Then the only filter options that will be displayed will include results, if added to the current filters. Users will not be able to produce an empty result set like this, but it also means that all filter options will not be displayed all the time - only the combinations that produce results.
at first i was thinking of creating a different search view (category maybe?) and placing it instead of the "no results" text. but that didn't work
I don't see any reason why this wouldn't work, unless this View is set up to respond to the same URL parameters as your original View, causing some conflicts. You would be able to get around this by removing any Filter Controls from this View, and predefining search criteria in your Query Filters. If you'd like to explore this a bit more, I would need to see more details about the two Views and how you have integrated them.
thank C 🙂
1. choosing "only show available inputs" doesn't work for some reason. maybe because it's checkboxes for a single filter? when i check "cheese", all other checkboxes (fot other ingredients, even if they are not available) stay. if that would work - it would be a great solution.
2) what i tried was create a new view with filter "categories" and based it on the current post in the loop. but i think anyway it wouldn't be a good solution because i need to base the search on ingredients and not categories...
i thought of maybe creating a new view of "ingredients" just instead of "all values" make it "any value" - and place only the search results instead of the initial search's "no results found" text. but that ended with the same result.
if that would work - it would be a great solution.
I see what you mean. The interesting thing is that if I choose the "multiple select" input type, the available options update as I would expect, but the behavior with checkboxes is not the same. I feel like this may be a bug, but I wanted to offer the multiple select input field as a temporary solution. I can escalate the issue with checkboxes not disappearing to our 2nd tier support team for further investigation. Let me know if you'd like to investigate this further and I will proceed there.
what i tried was create a new view with filter "categories" and based it on the current post in the loop.
I think you would create a new View of recipes, using the same filters as your current View of recipes, but change "All" to "Any" as you described. Then place this View in the other View instead of "No results found".
hey,
1) yes, please escalate this - i think it would also benefit others. i tried the "multi select" and it indeed works - but:
a) all taxonomies are in one box, which doesn't look great. if it would only look like when adding a category within a post (the categories are added one by one) - it would be better.
b) it's hard to style with css.
2) of course - this is what i tried 🙂 but then, i get ALL recipes when there's "no results" instead of just something close to the ingredients search.
thanks!
but then, i get ALL recipes when there's "no results" instead of just something close to the ingredients search.
Well not all recipes, only those that match any of the terms selected (which may be quite a few). I'm not clear on what you would like to show here instead, but it sounds like you would like to show the closest matching results. This type of logic isn't easily scripted in Views, so I can't think of a good way to do this without custom code. By design, you can search for matching all terms, any terms, or none of these terms. Beyond that you will need to use our Views filter hooks to modify the WP Query on-the-fly:
https://toolset.com/documentation/programmer-reference/views-filters/
yes, please escalate this - i think it would also benefit others.
Absolutely. I have escalated this and will continue to update you here as I receive more information.
hey,
1) it's show all recipes because always all inputs are available, i think. but let's forget about it - it doesn't help the issue anyway 🙂
2) thanks! looking forward to hearing about this...
ido
Ah yes, I see what you mean 🙂 Anyway, our 2nd tier support team has confirmed the issue and escalated it further to our developers. They will continue to investigate and as soon as I hear additional info from them I will update the ticket here. Thanks for your patience while we work on the problem.
thanks! much appreciated 🙂
Hi, our developers have released an errata and patch you can find here:
https://toolset.com/errata/checkboxes-are-not-working-like-multi-select-when-only-show-available-inputs-is-selected-in-the-advanced-search-settings/
The next release of the Views plugin will include a permanent fix for this issue, but you can follow the steps in the link above to install a temporary fix if necessary. Let me know if the problem is not resolved and I'll take another look.
works, thanks!
the only thing is that after checking one checkbox now, it changes the structure of the HTML. if before checking it was:
<label>
<div class="checker">
<span>
<input type="checkbox">
then AFTER checking it's:
<label>
<input type="checkbox">
and the "checker" div and the span are missing. this only happens when i mark "only show available inputs".
thanks!
Can you share the full contents of your Filter Controls panel for this View? Is any custom JavaScript applied to the filters? Does the behavior change when you activate a default theme like Twenty Seventeen?
hey,
here it is. no additional JS. strangley, on twentyseventeen, there are no checkboxes AT ALL. simply not appearing in the filter.
[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group">
<label><h1>[wpml-string context="wpv-views"]What's in your fridge?[/wpml-string]</h1></label>
<h2>Mark the ingredients:</h2>
[wpv-control-post-taxonomy taxonomy="ingredient" type="checkboxes" url_param="wpv-ingredient"]
</div>
[/wpv-filter-controls]
[wpv-filter-end]
Okay I think it's probably best at this point for me to make a clone of your site so I can do some further testing. I can install the Duplicator plugin to create that clone. If that's okay with you, please provide login credentials in the private reply fields here.
Let me know which View you are working on and where I can see the View on the site.
Thanks I was able to log in and I'm in the process of making a clone now. Which View should I look at, and where can I see the View on the front-end of the site?