Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Negative value range – Slider

Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Joost
    #161208

    Is it possible to use a negative value when using the ‘Range – Slider’ input type. I ask because it only seems to work when the min value is ‘0’ and not below ‘0’. I would like the range to be ‘-35’ to ‘300’.

    This is how I’ve set it up:

    Input type: Range – Slider
    Display values as: Input Field
    Start Meta Key: temperature_resistance / temperature_resistance_max
    Compare Mode: Post Meta must be within input range
    Min Value: Auto Detect
    Max Value: Auto Detect

    For some reason it will not show when the first value is below ‘0’.

    Can someone help with this?

    Trevor Moderator
    #161213

    I have referred this to the developer, Ross, for clarification.

    Joost
    #168533

    Is there an update for this question?

    Thank you in advance.

    Ross Moderator
    #168645

    Hi Jarno

    Sorry for the delay on this – I’ll update tomorrow.

    Thanks

    Ross Moderator
    #168780
    This reply has been marked as private.
    Ross Moderator
    #168784
    This reply has been marked as private.
    Stefan van den Berg
    #275392

    I know this is an old post, but someone might be helped by my findings.
    The problem with the range slider using negative number is caused by the filtering code casting the values to UNSIGNED, thus making the negative numbers positive before the comparision.

    If you open the files includes/fields/post_meta_choice.php and public/includes/class-search-filter-cache.php and search for UNSIGNED and replace it with SIGNED (and upload to your server), the filtering will also work with negative numbers.

    Ross Moderator
    #275395

    Awesome fine Stefan!

    We have tested with negative and I thought it was working, perhaps a different effect is triggered in different environments?

    Anyway, I’ll do some digging and hope to then add this to the next release.

    Best

    Stefan van den Berg
    #275437

    Hi Ross,

    if you use only negative numbers, everything will work fine because all numbers are made positive before the comparision

    But in my case, the facet search range was for example -2000 till +1000 and I have a setup with a start field and an end field in my post type. The Compare Mode is set to ‘Post Meta must be within input range’.
    A post with a start value of -400 and end value of +200 should be returned by the query. But if the values are cast to an UNSIGNED int, we check if +200 to +400 fals in the range of +1000 to +2000 and it is incorrectly removed from the search results.
    Hope that makes sense.

    Cheers,
    Stfan

Viewing 9 posts - 1 through 9 (of 9 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.