Forums Forums Search & Filter Pro Change filter value before getting the posts

Tagged: ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Trevor
    #274941

    There may well be a way, yes. Are you able to send me a live link/URL to your search page so I can take a look?

    Anonymous
    #275085
    This reply has been marked as private.
    Trevor
    #275183

    It may be that you can do this using this filter:

    https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments

    If you need help with the coding, I would need to refer this to our plugin developer, Ross, for his input.

    Anonymous
    #275427

    Hi Trevor, thanks for the response. I tried using the hooks that you mention but it seems the search filter values are not passed in that query, this is what the var_dump of the query looks like

    
    array (size=10)
      'paged' => int 1
      'search_filter_id' => int 156
      'search_filter_override' => boolean false
      'posts_per_page' => int 5
      'post_status' => 
        array (size=1)
          0 => string 'publish' (length=7)
      'meta_query' => 
        array (size=3)
          0 => 
            array (size=4)
              'key' => string 'end_date' (length=8)
              'value' => string '20210205' (length=8)
              'type' => string 'DATE' (length=4)
              'compare' => string '>=' (length=2)
          1 => 
            array (size=4)
              'key' => string 'status' (length=6)
              'value' => string 'closed' (length=6)
              'type' => string 'CHAR' (length=4)
              'compare' => string '!=' (length=2)
          2 => 
            array (size=4)
              'key' => string 'status' (length=6)
              'value' => string 'cancelled' (length=9)
              'type' => string 'CHAR' (length=4)
              'compare' => string '!=' (length=2)
      'post_type' => string 'property' (length=8)
      'is_search' => boolean true
      'orderby' => 
        array (size=1)
          'date' => string 'DESC' (length=4)
      'lang' => string 'en' (length=2)
    

    so the values for the price and other filters are not being passed in that array.

    Ross Moderator
    #275742

    Hi Juan

    I’ve been doing a pass of these forums and realised I had never got back to you, apologies.

    Unfortunately I can’t see a way to do what you want.

    Essentially the issue is that the meta query for price is not in the query – and that’s because we peform that part in a custom query, and return the IDs.

    So right now, I can’t see a way for you to condtionally modify those filters.

    I’m going to tag this post with v3 – as in, something I would like to add to v3, once the intial release is out.

    Thanks

    Anonymous
    #275760

    Hi Ross, thanks for the response, it’s a shame is not currently possible. I’ll look forward to it.

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