Skip Navigation

[Resolved] Filter search results by category

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

Problem:

Sort view's result by taxonomy terms.

Solution:

Toolset is using WordPress class WP_Query to query posts, see WP document:

https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters

There isn't any option to sort the result by taxonomy.

Relevant Documentation:

This support ticket is created 4 years, 1 month 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 6 replies, has 2 voices.

Last updated by renatoR 4 years ago.

Assisted by: Luo Yang.

Author
Posts
#1824573
Screenshot 2020-10-26 at 12.00.26.png

Hi.

We are trying to port an access database to Toolset. We run into a problem filtering and grouping the searchresults according the category title. hidden link (search for Lieferanten) we would like to get the same view. Ist this possible to achieve with the toolset funcionality without hardcoding it, resp. changes in the Toolset Code?

Thanks a lot and kind regards.
Renato

#1825649

Hello,

Toolset plugins are WordPress plugin, they can handle WordPress data, they can not handle data outside WordPress.

In your case, you might consider to import data into WordPress:
https://toolset.com/course-lesson/how-to-import-content-into-wordpress-using-csv/

Then follow our document to setup the custom search form:
https://toolset.com/course-lesson/creating-a-custom-search/

#1825673

Hi.

Thanks for your reply. All our data is in WordPress, we imported it via csv. But my developer claims that he cannot sort the search results by category as you can see in my attached screenshot. According to him it would be necessary to "hack" Toolset and hardcoding this function because Toolset is unable to do this. I would like to know from you guys if this is the case. It strikes me as a bit odd that Toolset would not enable such a basic operation?

Thanks so much for looking into it.

Kind regards
Renato

#1825691
taxonomy-filter.JPG

That is built-in feature of Toolset Blocks/Views plugin: search by taxonomies,
please follow the document I mentioned above to setup custom search form:
https://toolset.com/course-lesson/creating-a-custom-search/

See my screenshot taxonomy-filter.JPG

#1829411

Hi,
sorry didn't see your reply.
We have a search by taxonomy, that is not the issue here. We are searching for all products from one supplier and additionally the search results should be grouped by categories. Is this possible with Toolset?

Thanks for your help.

#1829421

Your developer is right, Toolset is using WordPress class WP_Query to query posts, see WP document:
https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters
There isn't any option to sort the result by taxonomy.

In your case, you can consider nested views.
See our document:
https://toolset.com/documentation/user-guides/views/using-a-child-view-in-a-taxonomy-view-layout/

But there will be some limitations, for example:
- The parent taxonomy view will outputs all terms, including those terms without posts
- The AJAX search won't work as expected.

#1829831

My issue is resolved now. Thank you!