Forums › Forums › Search & Filter Pro › Exclude Blank Items From Results
Tagged: V3
- This topic has 13 replies, 3 voices, and was last updated 4 years, 5 months ago by Trevor.
-
Anonymous(Private) July 17, 2020 at 9:56 pm #253238
I have a numeric “inches” range field on my form that ranges from 0 – 50.
Some of the records in my database do not have an “inches” value i.e. they are blank.
My client doesn’t want “blanks” getting included in the search result when they enter a filter of 0-19 but they also don’t want them excluded when the default 0 – 50 filter is enabled.
I thought one solution might be to force the filter to have a starting value of 1 but that obviously doesn’t work because the records with a blank “inches” value will never appear.
I’m at a dead end and would appreciate any guidance.
Anonymous(Private) July 18, 2020 at 3:05 pm #253250I’ve been thinking about this a bit more and I think the issue is that your plugin includes ALL number range filters in the URL query string even if they have not been touched.
If you only passed the filters that have been touched/modified AND cleared them all out of the URL string when “Reset” is pressed then I think I’d get my expected behavior.
Is there any workarounds you can think of here?
Anonymous(Private) July 18, 2020 at 4:50 pm #253251I was able to setup the desired experience with a competitor product. I’d prefer not to use that product but I’m going to paste the experience here because it illustrates what I’m trying to achieve
https://granderwatch-4b609e.ingress-alpha.easywp.com/?elementor_library=grander-archive
Post 1 has a tail value of 19 on it
Post 2 has a tail value of N/AIf the filter is adjusted at all, Post 2 is removed from the results.
If the filter is “reset” both Post 1 and Post 2 are returned even though the minimum value on the filter is 1 and even though Post 2 has a tail value of N/A.
This is the desired experience I’d like to create with Search & Filter Pro.
Trevor(Private) July 20, 2020 at 12:04 pm #253286The problem for us is that, N/A is not in the database. At all. There is no entry for that field for that Post, so, when a range is sent to as a filter, all such posts disappear. It is not like a spreadsheet with empty cells. The cells do not exist.
With no filters applied, all posts will show. There is, at this time, only one solution, and that is not to use a range field, but instead offer the user a list of ‘ranges’ to choose from, like this:
N/A
0-5
6-10
11-15This might require you to have a second custom field for ‘tail value’ with those text strings in. You can make an autosave function in your child theme functions.php that would autopopulate one field from the other.
Anonymous(Private) July 24, 2020 at 3:36 pm #253775I have the same problem. I have 100 cars.
90 cars have a given installment value. 10 cars no.
You can search in installments in the search engine. As a result, the search engine always shows 90 cars, and 10 will never appear after pressing “search”.Trevor(Private) July 24, 2020 at 3:50 pm #253782Krzysztof
My reply above in this post:
https://support.searchandfilter.com/forums/topic/exclude-blank-items-from-results/#post-253286
Is what you face. If you use a range field, as soon as you make a search, any car that does not have a value for that field will disappear. If you do not wish this to happen, you would need to create a new field with pre-defined ranges for the user to choose from, which are actually text strings/terms/tags.
Trevor(Private) July 29, 2020 at 6:15 am #254253This post shows an example of a year field being auto populated:
https://support.searchandfilter.com/forums/topic/datefilter/page/3/#post-238869
-
AuthorPosts