pdaleramirez / super-filter

Other
6 stars 2 forks source link

Dropdown default is "none". Need a way to make it non-specified / all / any. #14

Closed LucySparks closed 3 years ago

LucySparks commented 4 years ago

We've set your Super Filter plugin up to use an "and" relationship between two category fields.

All our items have values for categories 1 and 2 set.

Our category 1 renders as a checkbox list, and category 2 as a dropdown.

"None" is the default value for the dropdowns, it lists the actual category values beneath "none".

The issue is: if you're looking for something specific in category 1, but you don't mind / set which value you want for category 2, the search will always return nothing, because the dropdown is specifically requesting a none or null value for category 2 but all out items have values for category 2.

Basically, we'd like to know how to change the default "none" value in the dropdown to an "all" value or an "any".

Screen Shot 2020-10-29 at 9 48 44 am

Cheers

pdaleramirez commented 4 years ago

@LucySparks It is possible to modify the text "None" by using the template override feature. Instruction here https://github.com/pdaleramirez/super-filter#using-super-filter. You need to input an override folder on search setup page. Then you can copy the example templates in the plugin pdaleramirez/superfilter/plain/fields/dopdown.html to your specified override folder. Then on your site templates you can modify the look of your html.

LucySparks commented 4 years ago

Hi @pdaleramirez, thanks for your response. I am already using an override folder structure that has duplicated and adapted the templates from the 'plain' variation in your plugin. Yes, I can change the field label from none to all but I'm unclear on what value to pass or assign the dropdown option to return any or all options for category 2, in the filter query. At a guess * didn't work. Any light you could shed would be greatly appreciated. Thanks

pdaleramirez commented 4 years ago

@LucySparks I see what you meant now, I will make an enhancement and make a release soon.

pdaleramirez commented 4 years ago

@LucySparks I've released 1.2.1 a feature that allows you to change the category operator. On the Super filter settings choose "Or" under "Category Relationship Operator" field and save the setting. You can now use the "*" category value on your search parameter that value will return all elements that has category.

LucySparks commented 4 years ago

Hi @pdaleramirez Thanks for that, that's fixed it!