Forums Forums Search & Filter Pro Date Range Filter

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #224158

    I’m having a similar issue. Our company uses a custom table for better searches on the back end. This table contains a list of WC product’s with custom columns. One of them is a product’s 4-digit date, such as 1889 or 1990. We’re trying to incorporate a date range search. We know it’s not possible for taxonomy range searches, so we’re attempting to modify the query args just like Kaz. I successfully query our custom table and add a list of post ids to $query_args['post__in'], but the posts are not included on the shop page!

    For example, let’s say a user selects the dates 1913 to 1915. Normally we’ll get products exclusively with those dates; which happens to be only 9 products. I grab those dates from $customFieldsArray['_sft_pa_date']['active_terms']. I then run a query against our custom table and get another 5 products. The $query_args['post__in'] gets a total of 14 post ids in an array. Shop page only displays the original 9. I’ve been successful modifying the query to handle a custom meta query and setting post__not_in with a list of post ids that are successfully excluded.

    Any thoughts?

    Anonymous
    #224160

    What would solve my problem is if I could add to the various active_terms portion of the $customFieldsArray. Is this possible?

    Trevor
    #224269

    It is not possible to use the post__in in our query, as we use them already, so what you place there will get overwritten.

    I am not sure if you could use pre_get_posts to add something in, but be wary as this function can also upset our filter results.

    Anonymous
    #224467
    This reply has been marked as private.
    Trevor
    #224544

    I had to split the threads (the other was https://support.searchandfilter.com/forums/topic/date-range-filter/ ).

    Trevor
    #224546
    This reply has been marked as private.
Viewing 6 posts - 1 through 6 (of 6 total)