This could be possible using custom coding to make it work, we have some recommended list of service providers here who can implement such things for you: https://toolset.com/consultant/
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.
I have a view that lists all products (a custom post type) sorted alphabetically. This view has two front-end filters: by product category and subcategory (in one drop-down) and by producer (a custom taxonomy, in another drop-down). Filters are located at the top of the page above the product list.
What I need to do is to change a sort order so that items be sorted by product category first, then by product subcategory, and finally by title.
Unfortunately, sort by product category is not available for the product view. It seems that I can use only product fields and product custom fields for that.
I was thinking about two ways to achieve what I need:
1. Create some kind of a custom sort function that will be called by the view and provide a sort order I need. However, I'm not sure if Views support that.
2. I can create a desired sort order with nested views (i.e. taxonomy category view as a parent, taxonomy subcategory as a child, and a product view as a child of a subcategory view). This displays results in an order I need, but it seems to loose an ability to use front end filters. It looks like front-end filters for taxonomy views are not available as filters toolbar is hidden. Also, it would make no sense to filter product category by producer as there is no producer info in a product category. Producer info belongs to the product itself, not to a category that forms a top-level view. I can add product filter to a product view level, but then this filter would be repeated for each product category/subcategory. I, however, need to have one filter at the top for all product items instead. So this seems to be not an option either.
Is there any way to achieve what I need within Views? What's the best way to do so? Please let me know if you need any additional information from me.
For more info you can refer to this on how to utilize wp_query arguments: hidden link
This could be possible using custom coding to make it work, we have some recommended list of service providers here who can implement such things for you: https://toolset.com/consultant/
View filters are great. I think a can't use wpv_filter_query to provide a desired sort order because there is no option to group by a category within WP_Query. However, I think I can try to use a wpv_filter_query_post_process filter to sort items in a desired order after they are retrieved and before they are shown.
Plan B is to create a custom 'sort_order' field within a product that will be calculated each time a post is updated (or have a batch script that will update indexes). I can use this field then to sort products the way I need. It would probably be faster as there will be no taxonomy-sorting overhead any time a view is shown. It might work as some kind of 'crude' DB index.
Thanks for you help, I understand my options much better now.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.