Skip Navigation

[Resolved] Conditional Output is not showing correctly

This support ticket is created 5 years, 10 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 9 replies, has 2 voices.

Last updated by FelipeP5703 5 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#1210151
Custom Search Query.jpg
Conditional_Custom_Search_3.jpg
Conditional_Custom_Search_2.jpg
Conditional_Custom_Search.jpg

I started creating a view for the custom search field and I'm having dificulties with the following:

1) When selecting a custom field by using New Filter, I choose the select dropdown menu and I put a label for the first default option, does that mean that if it's ALL, then it will show all options? For example, I have a custom field named Session which has 3 sessions to choose from (Terapeuta, Massagista, and Clinic). Once I create a custom search and place a Label named ALL, the results should show all three sessions, correct?

2) I'm trying to add a conditional output for a selection field. I want to only show if the previous selection is 1. For example, I have state (Estado), two options, if the visitor chooses 1, then I want it to show the cities (Cidade), if the visitor chooses 1 for city, then I want it to show Neighborhoods (Bairros), and if the visitor chooses #2, to show Streets (Ruas).
But the conditional output is giving an error and not showing it. Screenshot attached.

Can the custome field content be something else besides a number? Text instead?

#1210267

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Felipe,

Thank you for contacting our support forum.

Lets see how best I can resolve this issue for you

1. If you add a default label to your filter, then yes when selected it will display all the items of the categories.

2. In your example you will actually need to compare the value from the URL parameter.

Example


[wpv-conditional if="( '[wpv-search-term param='wpv-wpcf-estado']' eq '1')"] 

Filter code goes here

[/wpv-conditional]

Can the custome field content be something else besides a number? Text instead?

Yes the value can be anything you want it to be.

Thanks,
Shane

#1210795
options_not_showing_2.jpg
options_not_showing.jpg

Thanks for the quick reply Shane!

1) Great! That's what I wanted to know.
2) It worked and I had to add the AND function as well to hide another parameter. I also had to change to "AJAX results update when visitors change any filter values" in order for the other option to show when the user changes the field. But, the option on the dropdown menu only shows the first option and not the rest on all the search fields. Why? How can I fix that? (See screenshot). Also the options for a radio (yes or no) is only showing one item or none.

3) When creating a radio and the visitor does not choose any, it should show both, correct? And if he chooses one and then wants to clear that section, he would have to reset the search?

#1210829
website2.jpg
website.jpg

Also, I have a website custom post field but it does not show the URL, it can only show a link, why is that? How can I show the URL of the website?
Images attached

#1210844
under_each_other_2.jpg
under_each_other.jpg

How do I put a repeatable single line custom type input under each other, like a list?
Images attached

#1210906
Alphabetic Order.jpg

How do I make the search result show in alphabetic order by post title? (see image)
How do I make a button to change the alphabetic order from A - Z and Z - A?

#1211499

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Felipe,

In order for me to assist effectively it would be best to open separate tickets for each individual issues.

Right now we have resolved the issue of hiding the filter and displaying them based on a user's selection.

So I will be responding directly to the thread here
https://toolset.com/forums/topic/conditional-output-is-not-showing-correctly/#post-1210795

But, the option on the dropdown menu only shows the first option and not the rest on all the search fields. Why?

I'm not sure what you mean by this, is it that the filter isn't showing all the available options ?

Also the options for a radio (yes or no) is only showing one item or none.
I'm assuming here that the option you are talking about is "sim" . I noticed in your other posts the option is now present. Is this still an issue ?

3) When creating a radio and the visitor does not choose any, it should show both, correct? And if he chooses one and then wants to clear that section, he would have to reset the search?

You mean if the user doesn't select Yes or No ?

In a case like this if the user didn't select anything then the filter will be ignored. If they selected something and want to clear it then yes they would need to use the reset button.

Thanks,
Shane

#1211600

Sorry, I thought I could use the thread to include the other issues too. I'll create other tickets for the other issues.

I'm not sure what you mean by this, is it that the filter isn't showing all the available options ?
Yes! The other available options are not showing. As I think about it, I think the other options only show if there are being used by the custom post. Meaning, when I created the custom post type with custom fields for the user to select and he has not selected that, it would not show in the custom search option. Because I created only two custom post to test it and it only shows the options those custom posts selected. I hope you can understand what I mean.

Also the options for a radio (yes or no) is only showing one item or none.
I'm assuming here that the option you are talking about is "sim" . I noticed in your other posts the option is now present. Is this still an issue ?

Sim means yes in Portuguese. Again I believe it has to do with the options chosen from the user. In my sample tests (2 custom posts, Felipe and Akemi) I believe I chose Yes in the Promotions tab (Promoções) for both of them, therefore it only shows Yes, instead of showing Yes and No. Is that the reason? Can't the search show both options then if the visitor chooses an option that is not available it would show "nothing was found."

You mean if the user doesn't select Yes or No ?
In a case like this if the user didn't select anything then the filter will be ignored. If they selected something and want to clear it then yes they would need to use the reset button.

Yes you clarified it for me. Thanks!

Maybe if I explain a bit better, it would make sense. I'm creating a classified Ad site with user registration. I created custom type and created some fields where users need to choose and enter their info and eventually show in the front end. Therefore if the custom field offers 10 options for the user to choose and the user chooses one, the other nine will not show as an option in the custom search section for the visitors (not users), is that correct?

Is there a way to show all available option even though the user did not choose those options? For example, I create 2 states in the custom field "Estado" but ALL of our current clients (users) are in Rio, therefore when the someone visits the website, it should show both "Estados" (states) but at the search result it would say, "could not find results" because there are no users who chose the other state.

Am I making sense? lol

#1211902

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Felipe,

1. This is how it actually works if you've enabled the settings for it. It ensures that your search will always return a result. You can actually disable this.

To disable it go to your Custom Search Settings in views.
Click on "Let me choose individual settings manually"
Then under "Which options to display in the form inputs" select "Always show all values for inputs"

2. This one is definitely related to my answer in 1 above.

Please let me know if this helps.

Thanks,
Shane

#1211957

My issue is resolved now. Thank you!