[Resolved] Custom View search for BETWEEN dates doesn’t work as expected

This thread is resolved. Here is a description of the problem and solution.

Problem: My Custom Filter for Dates BETWEEN a max and min date doesn't work properly and does not return the accurate results. This was working fine previous to Views 3.0 and stopped with the updates to 3.0 and 3.0.1

Solution: Update Toolset to the latest versions It was fixed here https://toolset.com/version/views-3-0-2/: >Fixed frontend searches using between comparisons created before Views 3.0.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 8.93 hours from now. Thank you for your understanding.

This topic contains 7 replies, has 2 voices.

Last updated by Beda 2 months, 1 week ago.

Assigned support staff: Beda.

Author
Posts
#1464851

I am trying to: Fix a view that worked before

Link to a page where the issue can be seen: hidden link

I expected to see: The ability to filter the event list by two dates

Instead, I got: The results no longer match the starting and ending dates entered, and the reset button no longer resets both date fields - only the ending date field. The date fields are being pulled from a custom calendar using the following post-meta-variables which are included on this list - hidden link - evcal_srow and evcal_erow.

#1465459

Beda
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

I've confirmed the issue on your site but cannot spot any unusual things just yet from the front end.

Do you recall what was the action that broke the filter?
An update, or some edit?
This will help us greatly to narrow down the possible issues

I tested such queries locally and they work as expected, hence it might also be a conflict with another software.
A possible test is to disable other plugins to see if the issue resolves

However, our best bet is to determine what broke it (which action) then we quickly will be able o pinpoint down the steps to replicate this issue on a fresh install and can then either fix it or if needed, let the 3rd party know in case its a compatibility problem.

#1471855

Hi Beda - I did the turn off all plugins and then turn them back on one-by-one to try and isolate the issue but that didn't help. And now I've noticed that filtering between two date fields is not working on another view on the site - this section for camp listings: hidden link

When originally set it up, you could search for camps that had a season start date between the two dates entered, which used the custom field kc-season-start, but it no longer works. You either get nothing or if you only fill in the start date option, you get all listings including listing with season start dates from the previous year.

I've gone back and reviewed documentation on how to allow visitors to search between two date fields, and as far as I can see, my implementation is correct, and both instances where we've used this on the site have worked previously, but are not now.

And to answer the question of what might have caused this or when did it happen, the Print Events list issue was reported to me right before the end of the year, so the last week of December and this other case with the kids camp section I discovered today while updating and testing a new listing. There have been no major updates made to the site during this time, but I know there were updates to Toolset Views recently. Not sure if that's when it started.

Any help would be appreciated. Please let me know if you would like admin access to the site and I'll set that up for you.

Tom

#1472563

Beda
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

The problem is I can't replicate this locally. You will probably experience the same, if trying to replicate this on a new View on your site, you will likely not see any issue.
Unless there is a Software interfering which you confirmed not to be the case, it could be a corruption of the View or of the Data.

Could I ask for a Duplicate of the site so I can analyse this locally and determine the cause and solution?
You can see here how to create one: https://toolset.com/faq/provide-supporters-copy-site/

#1474123

My issue is resolved now. Thank you!

#1474479

Beda
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Can I ask what the issue was?
This seems to be something replicable or at least eventually on some specific configurations, the way you described it.

I'd like to be sure not to omit some bug we need to address.
Thanks!

#1475299

Beda - I would love to say that I know, but I don't for sure. All I know is that I went back and compared the production version of the site to an older development version I had where the Print Events List tool was still working and turned off all plugins in the production version that were not being used on the dev site (which immediately corrected the issue - so I assumed it was plugin related), then turned them back on one-by-one, until all the plugins not being used on the dev site were activated again, and everything still worked. So I have no clue which plugin might have been causing the issue - since everything worked after turning them all back on again. I did have to update several plugins on the production site to match the versions on the dev site, including Toolset Views (to version 3.0.2 from the most recent previous version), which I noticed that one of the items listed in the release notes as having been fixed was...

Fixed frontend searches using BETWEEN comparisons created before Views 3.0.

So maybe that was it? I'm not sure.

Thanks for looking into it for me.

Tom

#1476191

Beda
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Yes, that must have been the issue.
I did not notice your Views plugin version was outdated, but in fact, I see now, you used Views 3.0.1 which is indeed outdated.

I apologise I wasn't paying attention to the version, I did assume (my mistake) you used the updated version.

A good reminder for myself to check better in the debug information you provide 🙂

Thank you for updating me, I also updated the resolution of the thread so others can find it.