Skip Navigation

[Gelöst] I need a parametric search filter on this results page

This support ticket is created vor 5 Jahre. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 4 Antworten, has 2 Stimmen.

Last updated by marcusC-4 vor 5 Jahre.

Assisted by: Waqar.

Author
Artikel
#1217135

I am trying to create a user controlled filter for this page: hidden link

The trouble I am running into is that I don’t have an option to add "Product Categories" to the Search & Pagination area.

I'm using a Taxonomy Filter to limit which products appear on the page and I’m selecting only 3 "Product Categories".

The results are great when the page first loads. Where I’m stuck is trying to allow users to further filter the products. I want them to be able to choose from those 3 product categories and update the results.

Is this possible? I feel like I’m missing something obvious.

#1218135

Waqar
Supporter

Languages: Englisch (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Marcus,

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

To include a filter for "Product Categories", which visitors can change from the front-end, you can follow these steps:

1. Please open your view's edit screen and if you've added any fixed/static filter for product categories in the "Query Filter" section, please remove it.
( screenshot: hidden link )

2. Next, scroll to the "Search and Pagination" section and click the "New filter" button.
( screenshot: hidden link )

3. From the new popup window, select "Product categories" from the taxonomy filters section.
( screenshot: hidden link )

4. Select the type of front-end filtering field that you'd like to use for this, from the next screen and click "Insert shortcode" button.
( screenshot: hidden link )

5. This will add the shortcode for the front-end filter in the "Search and Pagination" section ( screenshot: hidden link ) and a connected dynamic query filter, in the "Query Filter" section ( screenshot: hidden link ).

6. As the last step, you can adjust the "Custom Search Settings" and the submit/reset buttons, as needed.
( screenshot: hidden link )

We also have a guide on the topic of search filters at:
https://toolset.com/documentation/getting-started-with-toolset/filter-content-lists-and-add-custom-search/

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

regards,
Waqar

#1218271

If I understand this correctly, then you are suggesting that I remove the filter that currently limits what is loaded on the page. The problem with that option is that I am then loading every single product on the page. What I want is to load only products from a few categories, then allow the user to further filter the page using those categories as the filter options.

It seems that this is not possible using Toolset, so I’ll explore other options. If you have any suggestions, please leave them here. Otherwise, I’ll close this ticket next time I’m on here.

#1218874

Waqar
Supporter

Languages: Englisch (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Marcus,

Thanks for writing back.

In your requirement, there are two challenges:

1. The front-end filters that visitors can interact with should be limited to only selective product categories.

This one is simple and you can add a checkbox type field for the product categories filtering (as explained in my last message) and hide the checkbox options through custom CSS code, which should not be available on the front-end.

2. The second part is that by default and with no filters when the page loads, it should only restrict the results to the specific product categories.

For this filtering, you can use "wpv_filter_query" filter along with "Taxonomy Parameters":
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

Here is an example snippet which should make its usage more clear:
https://toolset.com/forums/topic/excluding-a-taxonomy-from-a-view-using-a-filter-hook/#post-552238

For more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar

#1219323

My issue is resolved now. Thank you!

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