Skip Navigation

[Resolved] Finding the plugin file for views filters.

This support ticket is created 3 years, 10 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Shane 3 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#1982485

Tell us what you are trying to do?
We have a view that has filters allowing the filtering of results by woocommerce attributes. Having some ordering of attributes issues and wanted to see how the plugin query for the filter attributes is written. Looking through the plugin files I can't find it. Can you help direct me to the file that handles the output of the views filter queries?

Is there any documentation that you are following? No

Is there a similar example that we can see?

What is the link to your site?
hidden link

#1982593

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ken,

Thank you for getting in touch.

Are the attributes that you want to sort contain any float values ? Meaning are there any decimal points in them ?

I've had a look at your size attribute filter and it is sorted in the correct order from what I can see.

Please provide further clarification on this one for me.

Thanks,
Shane

#1982683

Yes some of our attributes have decimals in them. We have the attributes in Woocommerce set to "Custom Ordering" so when configuring the terms we can arrange them in any order needed and not depend on date,name,ID, ect. The problem is that when creating the view filter the output on the front end does not retain that custom ordering even if we set the sort setting on the filter to "none". I am trying to read through the plugin files to see where A.) the options for sorting (Name, ID, Count, Slug, Group, None) are defined/set and B.) Where that setting is being added to the query args. Wondering if I can create a function/filter to add in the option to order by meta_value_num and if selected add the args to the query/get_terms.

#1982759

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ken,

Thanks as suspected.

We do not actually have an inbuilt solution for this and any solution would need to be done using custom code.

You will need to modify the term clause using the hook below.
https://developer.wordpress.org/reference/hooks/terms_clauses/

This will allow you to modify the SQL query to change the ORDER BY clauses to order by ‘name+0’ instead of ‘name’, which will order as numeric not string.

Unfortunately this is not something that we here can assist with as this would be out of the scope of our Support forum.

Thanks,
Shane