Sauter la navigation

[Résolu] URL parameter filter gives inconsistent results in a View

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I have a View that is filtered by a custom field value, set by a URL parameter. The results should include posts that have a custom field value less than or equal to the number I pass into the URL parameter. The results do not seem to be accurate, because param=999 gives me 3 results but param=1000 gives me no results.

Solution: Check the query filter settings. The compare value type should be "UNSIGNED" instead of "string" when comparing numeric values.

Relevant Documentation:
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/#compare-value-type

This support ticket is created Il y a 6 années et 8 mois. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par davidZ-4 Il y a 6 années et 8 mois.

Assisté par: Christian Cox.

Auteur
Publications
#679359
urlparm issue in view.JPG

I am trying to: display woocommerece products based on a view that get urlparm (query string) of price and display max 5 products with price equal or less than the price defined in the urlparm

Link to a page where the issue can be seen: lien caché

I expected to see: no products listed on the page

Instead, I got: 3 products with price higher than 999 display on the page

i noticed that there is a range of price this is happen
for example"lien caché
will get no results as expected.
however if i change urlparm to 20 like this
lien caché
i will get one result
if i use lien caché
i get three results
if i use lien caché
i get no results as expected

i have only 5 products in the store with variations of max 2 variations to each of four products and one product with no variations.

you can see the view search setting in the enclosed image

Please advice,
thanks,

David

#680634

In the custom field filter area, change the "string" option to "UNSIGNED" so that the values are compared using a numeric algorithm. Then try again and let me know if this does not resolve the problem.

#680773

Hi Christian,
I changed this to a number and its working just fine.

Thanks,

David