Forums Forums Search & Filter Pro Filter Numbers with thousand separator

Viewing 10 posts - 1 through 10 (of 39 total)
  • Anonymous
    #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 understandable

    Thank you very much for your support!

    Trevor
    #246411

    You 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
    #246414

    Hi 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 :,) .

    Trevor
    #246416

    Does your theme use a PHP template to display this page, and use PHP to output the number to the page?

    Anonymous
    #246421

    I use Divi theme and created a Child Theme to use PHP there but I have not added any php yet. Does this answer your question?

    Trevor
    #246425

    How do you tell Divi to output the ACF field on the page?

    Anonymous
    #246428

    For the cars page I used Elementor and there I have a text editor field with dynamic content that refers to the ACF field

    Trevor
    #246430

    Could you show me the code you use?

    Anonymous
    #246432

    I dont know which code you mean. Thats the page: https://autolocal.ch/vehicles/

    Trevor
    #246436

    What did you enter or type in to the Text Editor field?

Viewing 10 posts - 1 through 10 (of 39 total)