Forums › Forums › Search & Filter Pro › Date filter always produces zero results
Tagged: date filter issue
- This topic has 22 replies, 3 voices, and was last updated 4 years, 4 months ago by Ross.
-
Anonymous(Private) May 22, 2020 at 11:54 am #245459
Last week, I received support for ticket #244732. That problem has been solved. However, since then, another part of the filter has ceased to function: whenever I select a checkin and checkout date, the search results are always zero accommodations. I am 100% sure that there are many accommodations available in any of the weeks in may, june and july.
You can see it here: https://kwo-villa.com/en/all-accommodations/
I have tested reverting to S&F Pro version 2.5.0 (was changed to 2.5.1 beta for ticket last week), but that does not help. I cannot find any fault in the filter, it just produces no results.
Can you please have a look? The credentials I sent in the former ticket remain the same.
Kind regards,
BorisTrevor(Private) May 22, 2020 at 5:12 pm #245569I wonder if it is this setting:
https://www.screencast.com/t/yY3SDxtBlZ
It would usually be set to
YYYYMMDD (ACF)
Looking at your data, it should be that.
Anonymous(Private) June 5, 2020 at 7:52 am #247527Hello Trevor,
sorry for not getting back sooner, was occuppied with the other suport ticket Ross is working on.I checked your suggestion, but it is actually already set up like you suggested.
My developer managed to solve the problem by manually changing the class-search-filter-cache.php file from line 1292 (else if compare_mode overlap onward to this:
else if($filter['compare_mode']=="overlap") { $field_terms_results = $wpdb->get_results( $wpdb->prepare( " SELECT post_id, post_parent_id, field_value_min, field_value_max FROM (SELECT min_table.post_id as post_id, min_table.post_parent_id as post_parent_id, min_table.field_value as field_value_min, max_table.field_value as field_value_max FROM (SELECT post_id, post_parent_id, field_value FROM $this->table_name WHERE field_name = '%s') AS min_table LEFT JOIN (SELECT post_id, field_value FROM $this->table_name WHERE field_name = '%s') AS max_table ON min_table.post_id = max_table.post_id) as range_table WHERE ( cast(field_value_min AS $cast_type) > cast(%s as $cast_type) AND cast(field_value_min AS $cast_type) < cast(%s as $cast_type) ) OR ( cast(field_value_max AS $cast_type) > cast(%s as $cast_type) AND cast(field_value_max AS $cast_type) < cast(%s as $cast_type) ) OR ( cast(field_value_min AS $cast_type) < cast(%s as $cast_type) AND cast(field_value_max AS $cast_type) > cast(%s as $cast_type) ) OR ( cast(field_value_min AS $cast_type) >= cast(%s as $cast_type) AND cast(field_value_max AS $cast_type) <= cast(%s as $cast_type) ) ", $start_field_name, $end_field_name, $min_value, $max_value, $min_value, $max_value, $min_value, $max_value, $min_value, $max_value ) ); }
I really do not want to revert to manual customization of plugin files, because that will cause me headaches with any future plugin update. Is there a way to make this change without altering the plugin files itself?
Ross Moderator(Private) June 5, 2020 at 8:33 am #247529Hi Boris
I will say, that this change is surely going to affect the work we are doing in the other ticket.
We are using compare mode == overlap in the other ticket, and this modification will affect that work too.
I’ll start by saying, compare mode = overlap, does work, and has worked for many users – so the way to tackle the problem is not to modify the plugin, but to figure out why it is not working in correctly in your setup.
So, lets close the other ticket first (I’ll reply soon) and then we’ll move back on to this one – with a a different approach.
Thanks
Ross Moderator(Private) June 5, 2020 at 10:56 am #247569Hi Boris
So now we’ve closed the other thread, lets tackle this.
Can you recreate this issue in the staging site we have been working on?
Leave it stripped back with my modifications to templates etc, but lets work on staging so we can tackle this in another way.
Best
Anonymous(Private) June 5, 2020 at 11:22 am #247581Hi Ross,
I’ve tried to recreate the issue on the staging site, but I can’t. I’ve equalized everything I could find:
– same themes/KWO-villa/search-filter/results.php file
– removed the customized search-filter-pro/public/includes/class-search-filter-cache.php file
– replicated all the settings in the live filter to the villafilter-nl-test on the staging site.Do you see any other difference?
What I can see, is that on the staging site it also doesn’t work as it should: all the “Wald” accommodations are actually blocked from booking from june until september 30. But if I select any date range, they all still show up. Until I refresh the page with F5.
Ross Moderator(Private) June 5, 2020 at 1:01 pm #247636Hi Boris
So, lets forget the difference between the 2 sites for now (probably something is disabled) and focus on getting staging working.
Can you provide me a url of a search, that shows the “wald” accomodation, but shouldn’t show it?
Thanks
Anonymous(Private) June 5, 2020 at 1:25 pm #247640But you need to select the dates (june 15 to june 22) yourself. Then you will see that at first it still shows all of the accommodations, and only after a refresh does it show the results as they should.
However, for now I think it’s better to focus on the live website, where we do not get any results at all no matter what dates you enter. If we fix that, we can always see if the other problem exists on the live website as well.
Ross Moderator(Private) June 5, 2020 at 1:34 pm #247643Hi Boris
It’s important to me to work on staging, because a lot of things are removed, and it gives a cleaner environment to work on. When you layer issues togethe it makes it much harder to debug – this way we can approach it step by step.
So I see on staging, the issue there is, you are using search form ID
10652
but your results are ID9358
, so they cannot work together:https://ispacetest.nl/alle-accommodaties/
Thanks
Anonymous(Private) June 5, 2020 at 1:54 pm #247649Hi Ross,
you’re absolutely right, I just couldn’t reproduce the issue on staging. But now I have:
I overlooked the difference in ID’s you noticed. I changed the ID to show the 10652 results on the page. Now the problem is the same as the live website.
If I select june 15 and june 21 for instance as first and last days, I get a blank page for results. Do you see it too?
-
AuthorPosts