Forums › Forums › Search & Filter Pro › Filter Numbers with thousand separator
Tagged: thousand separator
- This topic has 38 replies, 2 voices, and was last updated 4 years, 5 months ago by Anonymous.
-
Anonymous(Private) May 29, 2020 at 9:41 am #246407
Hey
I have a car selling website and I use s&f to filter the prices (amongst others)(I use ACF for the fields). The problem is that the filter only works if there is no thousand separator and I would like to have numbers in this format: 32’000, 1’000, 100’000 etc.
I already asked ACF Support but they couldnt help me out. Is there a way the filter works when using an ACF text field (instead of a number field because then I can not put a ” ‘ ” in there) with a separator like “‘”?
Btw: I dont mean the numbers in the filter itself (like meta slider), I mean the numbers that are displayed on the front end on every car.If thats not possible I will have to have a second ACF price field for every car without separator and than I will link the filter to the second price field that wont be displayed on the front end. I think that would work but thats laborious because there are more than one number field that should be filtered.
I hope I could describe understandableThank you very much for your support!
Trevor(Private) May 29, 2020 at 9:53 am #246411You can display a number field with added formatting using PHP to convert the number to text, but it is not possible to range filter a field that already has that formatting, as it is, in effect, a text field and not a number field.
It would be far better to store these as pure numbers, and use PHP to format them in the front end. But, if you don’t have this option, you would need two fields. It is possible to create PHP to automatically fill one field from the other when you save.
Anonymous(Private) May 29, 2020 at 9:59 am #246414Hi Trevor
Thanks for your fast reply!
Storing these as pure numbers and format them in the front end is what I tried before with ACF Support which wrote me this: “It has just come to my attention that this is a PHP limitation after several tests. It looks like the number field can only save decimals and not commas when using a float. Even though the data is updated, the comma will not be displayed and thus you will need to use a text field instead that returns a string. ”Because I dont know so much about PHP I dont know what would be the best to do now :,) .
Anonymous(Private) May 29, 2020 at 10:11 am #246432I dont know which code you mean. Thats the page: https://autolocal.ch/vehicles/
-
AuthorPosts