Skip Navigation

[Resolved] Display only product assigned taxonomies in the dropdown

This thread is resolved. Here is a description of the problem and solution.

Problem:

I am trying to create search form with Views plugin

Filter by parent child relationship for brand>Model

storage and color are taxonomies. I don't want all storage options to be displayed in select dropdown. Suppose, A phone has only 3 storage options(8gb, 16gb, 128gb) i don't want extra options to be displayed.

Solution:

You just need to enable the option "Show only available options for each input" in Views custom search settings, see our document:

https://toolset.com/documentation/user-guides/front-page-filters/advanced-settings-custom-search/

Screenshot:

https://cdn.toolset.com/wp-content/uploads/2018/01/toolset-views-custom-search-settings-manual-1.png

And it should be able to work with taxonomy field of Views custom search form

Relevant Documentation:

https://toolset.com/documentation/user-guides/front-page-filters/advanced-settings-custom-search/

This support ticket is created 6 years, 8 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/Hong_Kong (GMT+08:00)

This topic contains 8 replies, has 2 voices.

Last updated by shabnamN 6 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#629391
Screen Shot 2018-03-29 at 1.05.01 am.png

I am trying to create search form with depended fields.
Product-Phone

using parent child relationship for brand>Model

storage and color are taxonomies. I don't want all storage options to be displayed in select dropdown. Suppose, A phone has only 3 storage options(8gb, 16gb, 128gb) i don't want extra options to be displayed.

website link:
hidden link

Thanks,
Shabnam

#629454

Dear Shabnam,

Is this problem resolved?
I have tried it in your website, if select the options:
Apple-> Iphone 6s, I can see there isn't any other option in dropdown "Storage".

And in your case, you just need to enable the option "Show only available options for each input" in Views custom search settings, see our document:
https://toolset.com/documentation/user-guides/front-page-filters/advanced-settings-custom-search/

#629485

The implemented approach is different is post relationship. I want to change this approach as i need to compare and calculate the fields in view. The output of these select boxes are some ids that cant be used further to compare.

So, i want to replace storage and color with taxonomy with same functionality as it is giving now but when i used taxonomy but it didnt work.

Please guide me.

#629492

As I mentioned above:
https://toolset.com/forums/topic/display-only-product-assigned-taxonomies-in-the-dropdown/#post-629454

you just need to enable the option "Show only available options for each input" in Views custom search settings, see our document:
https://toolset.com/documentation/user-guides/front-page-filters/advanced-settings-custom-search/
Screenshot:
hidden link

And it should be able to work with taxonomy field of Views custom search form, and I can not see the problem in your website:
hidden link

If you still need assistance for it, please try these:
1) deactivate other plugins and switch to wordpress default theme, and test again
2) If the problem still persists, please provide a database dump file (ZIP file) of your website in below private detail box, also point out the problem page URL, I need to test and debug it in my localhost, thanks

#629536

Thanks for the details, I have done below modification in your website:
1) Create a view with two filters
hidden link
a) Taxonomy filter
Select posts with taxonomy:
storage taxonomies slug in one of those set by the URL parameter wpv-storage_taxonomies
eg. hidden link
b) Post relationship filter
Select posts that are children of the Post with ID set by the URL parameter wpv-pr-child-of.
eg. hidden link

in section "Custom Search Settings", enable the option "Show only available options for each input"

2) Display it in a page:
hidden link

Please test again, check if it is what you want.

#629791

This solution is working fine but there is an issue.
Now if i want to change the phone model it doesn't change without a reset.
Is it possible to have All brands to be visible always other fields can be limited?

Secondly, I have generated output by calculating the fields depending on the search filters. The result is appropriate for all the select fields. The issue starts with the checkboxes as the pass false value when the unselected checkbox is added in the conditional loop.

This one works,
[wpv-calculate]
[types field='[wpv-search-term param='wpv-storage_taxonomies']' format='FIELD_VALUE'][/types]+
[types field='[wpv-search-term param='wpv-color']' format='FIELD_VALUE'][/types]+
[types field='[wpv-search-term param='wpv-pa_phone-in-warranty']' format='FIELD_VALUE'][/types]+
[types field='[wpv-search-term param='wpv-pa_condition']' format='FIELD_VALUE'][/types]
[/wpv-calculate]

Issue with this,
[wpv-calculate]
[types field='[wpv-search-term param='wpv-storage_taxonomies']' format='FIELD_VALUE'][/types]+
[types field='[wpv-search-term param='wpv-color']' format='FIELD_VALUE'][/types]+
[types field='[wpv-search-term param='wpv-pa_phone-in-warranty']' format='FIELD_VALUE'][/types]+
[types field='[wpv-search-term param='wpv-pa_condition']' format='FIELD_VALUE'][/types]+
[wpv-conditional if="( '[wpv-search-term param='wpv-pa_accessories']' eq 'box' )]
[types field='box' format='FIELD_VALUE'][/types]
[/wpv-conditional]
[/wpv-calculate]

#629794

Also, I don't need 0 to be displayed in output.

#629887

I assume the original problem of this thread is resolved:
https://toolset.com/forums/topic/display-only-product-assigned-taxonomies-in-the-dropdown/#post-629391
don't want all storage options to be displayed in select dropdown

For the new questions:
Q1) Is it possible to have All brands to be visible always other fields can be limited?
No, there isn't such a feature, if you agree, we can take it as a feature request.

Q2) the checkboxes as the pass false value when the unselected checkbox is added in the conditional loop.
And
Q3) I don't need 0 to be displayed in output.

They are new questions, I am not sure how do you setup the link and URL parameters, and I have tried to login your website again, but get this error:
ERROR: The password you entered for the username admin is incorrect

Since they are new questions, please create new thread for each new question, describe detail steps to duplicate same problem, that will help other users to find the answers.

#629902

Thank you so much for the help Luo Yang.