Skip Navigation

[Resolved] One search option per page

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

Problem:
As an example, when you first load the Page where the View is inserted on, you select a "color", after you select a color, another filter is displayed where you can select size, then another one is loaded to select a fabric... and so on.

How can I make it with Views?

Solution:
It's not something supported out of the box by Views, but in some scenarios you can Use HTML Conditons to achieve this behaviour or Searches that take URL parameters from previous submitted Views.
There is an extensive illustration about this here:
https://toolset.com/forums/topic/one-search-option-per-page/#post-480676

This support ticket is created 7 years, 3 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 2 voices.

Last updated by nereaD 7 years, 3 months ago.

Assisted by: Beda.

Author
Posts
#480553

I am trying to make a tool to show a unique product after applying some filters. But I need each filter to be in a different page or slide.

I.E.: First you select a color (the only filter you see is "color" and its options), after you select a color, another filter is loaded where you can select size, then another one is loaded to select a fabric... and so on.

Does it make any sense? How can I make it with Views?

My products are custom types with a number of custom taxonomies. (IE parent taxonomy "color", child taxonomies "yellow, blue, red...")

Thank you! 🙂

#480676

Yes, it makes sense, although it's not something we support out of the box.

There are 2 solutions, which might need a little of adoption.

1. Use HTML Conditional.
You can wrap the single Search ShortCodes into HTML conditionals that check for the Search parameter of the previous Search Form, and if that is not empty, it'll display, otherwise hide.

As an example:

[wpv-control taxonomy="post_tag" url_param="wpv-post_tag" type="select" hide_empty="true"]
  [wpv-conditional if="( '[wpv-search-term param='wpv-post_tag']' ne '' )"]
    [wpv-control taxonomy="category" url_param="wpv-category" type="select"]
  [/wpv-conditional]

This above requires, of course, an URL update on search, so the code can listen for a URL parameter like ?wpv-post_tag= and check if that's not empty, or not equal certain values.

2. The second option is to create several Views, each with one parametric Search, that also takes the Query Filter by URL argument from the previous view.

The Search Results would be display on another page where instead of the Results, you insert the next Search View, and so on, until you want to display the Result.

The View with the results must take all URL parameters passed by the antecedent Views.

I would suggest the second approach, keeping in mind that this is not what was thought when Views was built.
It might have some limitations in it's usability

#481377

Thank you very much for your quick reply!

Both solutions work perfect for what I need, I´m going with the first one just because it fits better with the page design.

Thanks!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.