Skip Navigation

[Resolved] Filter shows item count but click results 0

This support ticket is created 3 years, 7 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 11 replies, has 2 voices.

Last updated by katjaL 3 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#2030279

I have multiple filters and one of them is custom field filter which has worked before ok, but now it doesn't anymore. Or some of it's items don't give results (even though there are) after clicking, some do. So those which don't give results (or give the 0) kill the filter search completely.

The search is here hidden link
And the malfunctioning filter is "Tilaisuuden luonne", check for example "Armoton biletys", it works. And for example the first one doesn't work "Teemajuhla..." and there are others that work/doesn't work. I can't find any logic. And I checked the custom fields, there are no empty spaces IMHO (didn't check database though).

I've tried ajax/non-ajax, different filters (checkbox, select) and remaking the filter, no help there.

#2030583

Hi,

Thank you for contacting us and I'd be happy to assist.

To troubleshoot this, I'll need to see how this view is set up in the admin area.

Can you please share temporary admin login details, along with some example filtering cases, which should be showing the results but are not?

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#2033711

Thank you for sharing these details.

Just wanted to let you know that I'm currently performing some tests on my website with a similar setup.

I'll share my findings as soon as this testing completes.

Thank you for your patience.

#2036477

Thank you for waiting.

During testing on my website with a similar checkbox field, I was able to reproduce this behavior.

For the "Tilaisuus" checkbox type custom field, the actual text for the options is saved in the "Value to store" field.
( screenshot: hidden link )

This is not only an inefficient approach in terms of performance, but is also prone to fail when used with the search filter comparisons, similar to the issue that you're facing. While working with the options for the checkbox, checkboxes, select, or radio type custom fields, it is recommended to store numerical raw values in the database.

To fix this field, I'll recommend the following steps:

1. Please go to your field group "Muusikko" that holds this "Tilaisuus" field and update all options with incrementing unique values, stored in the "Value to store" field and with "Show one of these two values:" selected. You can store the title text in the "Selected" field below.
( example screenshot: hidden link )

This will make sure that a numerical raw value is saved for each option in the database, but when that field will be shown on the front-end, the text title and not the raw value will be shown.

2. After this change has been made, you'll need to open the edit screen of all the posts where this custom field has been used and then save/update it once so that the new custom field values for this "Tilaisuus" field can take effect in the database.
( you won't have to select the relevant checkboxes options again as they'll be selected already )

3. The last step would be to update this field's search filter field in the view. You'll remove the existing search field code for this field from the view's "Search and Pagination" section and also remove the relevant query filter for this field.

After that using the "New filter" button you'll add the search filter again, making sure to add all the numeric values and their relevant text titles, manually.
( example screenshot: hidden link )

I hope this helps and please let me know if you need any further assistance around this.

#2038031

Hi Waqar and thank you very much of this detailed explanation and instruction. I think I have done all the steps, but now that I've saved couple of posts, the new select stays empty. So something is still wrong.

#2041331

Thanks for writing back.

I've checked your website and noticed that the suggested steps have been followed correctly.

You'll find a test view on the page named "Test page from TS support" which shows that only 2 posts have been updated to hold the updated numerical "Tilaisuus" field values.

I'll suggest updating all plugins specially Toolset ones to their latest versions and then clear all involved caches and then check the search filter.

In case the filter still doesn't work, you're welcome to share a clone/snapshot of the website so that it can be investigated on a different server.
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )

Note: I've set your next reply as private.

#2043483

Thank you for sharing the duplicator package.

I'm currently performing some tests on my server and will share my findings, as soon as this testing completes.

Thank you for your patience.

#2049915

Thank you for waiting as this troubleshooting is taking longer than I expected.

I'm just completing some tests and will share the detailed update, within the next few hours.

#2051305

Thank you for waiting.

During testing on the clone of your website, I was able to make the 'tilaisuus' field's filter work, by changing its shortcode in the 'Search and Pagination' section, from:


[wpv-control-postmeta field="wpcf-tilaisuus" type="select" source="custom" default_label="Valitse tilaisuuden luonne" format="%%NAME%% (%%COUNT%%)" url_param="wpv-wpcf-tilaisuus" values="1,2,3,4,5,6,7,8,9" display_values="Teemajuhla: häät%%COMMA%% syntymäpäivät%%COMMA%% pikkujoulu,Yritystilaisuus,Armoton biletys,Viihdyttävä%%COMMA%% tanssittava,Hillitty%%COMMA%% taustamusiikiksi sopiva,Akustinen%%COMMA%% kerrostaloon sopiva,Harras%%COMMA%% hillitty: vihkiminen%%COMMA%% ristiäiset%%COMMA%% hautajaiset,Viihdyttävä%%COMMA%% kuunneltava (ei taustamusiikki),Lastenjuhlat"]

To:


[wpv-control-postmeta field="wpcf-tilaisuus" type="select" source="custom" format="%%NAME%%" url_param="wpv-wpcf-tilaisuus" values=",1,2,3,4,5,6,7,8,9" display_values="Valitse tilaisuuden luonne,Teemajuhla: häät%%COMMA%% syntymäpäivät%%COMMA%% pikkujoulu,Yritystilaisuus,Armoton biletys,Viihdyttävä%%COMMA%% tanssittava,Hillitty%%COMMA%% taustamusiikiksi sopiva,Akustinen%%COMMA%% kerrostaloon sopiva,Harras%%COMMA%% hillitty: vihkiminen%%COMMA%% ristiäiset%%COMMA%% hautajaiset,Viihdyttävä%%COMMA%% kuunneltava (ei taustamusiikki),Lastenjuhlat"]

Note: since we're using the custom options provided to the field's filtering field, the option to show the '%%COUNT%%' doesn't work.

And in the view's 'Custom Search Settings' settings, I also had to select the 'Always show all values for inputs' option, for these custom field options to show.
( screenshot: hidden link )

You'll see these changes working on your website too ( hidden link ) and please don't forget to update all posts where this 'tilaisuus' custom field has been used, so that the new numerical value can be saved.

#2059165

Hi Waqar and thank you for your efforts! For me this makes the situation pretty uncomfortable because I don't know what was wrong. Can you tell me please? (I would like to fix same kind of filters elsewhere and avoid this in future filters.)

#2060825

Thanks for writing back and I'd be happy to summarize what we've discussed, to make things more clear:

When working with checkboxes type custom fields that have complex text in options, you'll have to make note of these 3 things:

1. For the field's options, make sure that the numbers are stored as 'values' and not the title text.
( example screenshot: hidden link )

2. When you'll be adding this field's search filter in the view, you'll need to add all the numeric values and their relevant text titles, manually.
( example screenshot: hidden link )

3. And lastly, in the view's 'Custom Search Settings', please also make sure to select the 'Always show all values for inputs' option, so that the manually added values and titles for this field's options are shown in the search form.
( screenshot: hidden link )

Please let me know if any point or step is still not clear or you face any challenge in making the search filter work in any other view.

#2060827

My issue is resolved now. Thank you Waqar very much!