Forums › Forums › Search & Filter Pro › Date Range Filter
Tagged: V3
- This topic has 5 replies, 2 voices, and was last updated 5 years ago by Trevor.
-
Anonymous(Private) October 19, 2019 at 12:27 am #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 settingpost__not_in
with a list of post ids that are successfully excluded.Any thoughts?
Trevor(Private) October 21, 2019 at 6:17 pm #224269It 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.
Trevor(Private) October 24, 2019 at 5:51 pm #224544I had to split the threads (the other was https://support.searchandfilter.com/forums/topic/date-range-filter/ ).
-
AuthorPosts