Forums › Forums › Search & Filter Pro › Cannot find results using date on post meta
Tagged: datepicker input format
- This topic has 9 replies, 2 voices, and was last updated 5 years, 9 months ago by
Trevor.
-
Anonymous(Private) August 5, 2020 at 4:24 pm #255182
Hi there,
We are using a combination of fooEvents and WooCommerce to create an event shop.
Using the post meta field we can grab ‘WooCommerceEventDate’ which is the event date.
If we use the choice selector at the top, we can get the drop down options automatically with the dates stored in the product and this works. I believe this checks as YYYY-MM-DD for the value.However this is not user friendly as there will many dates of courses, hence why we need the date option at the top which uses a datepicker as its input. We no longer will receive any results from this date picker as i am guessing it is submitting the value as something different to YYYY-MM-DD hence the query not working.
Any light you could shed would be fantastic.
Cheers,
Richard
Trevor(Private) August 6, 2020 at 2:54 pm #255256Can I ask you to update Search & Filter to v2.5.1 first? MAKE A FULL BACKUP of the site first.
You will need to download it from Your Account, then delete the current version from plugins (I have checked, and nothing will be lost). The install the new version. WordPress will not offer the update, as we have a new server and this old version does not recognise it.
Let me know when you have done this?
Trevor(Private) August 6, 2020 at 6:13 pm #255294For a WooCommerce form, the Ajax Container will almost always need to be
.products, and this is so for your site.I have looked in to the database and there are two dates that are stored very wrongly. That MIGHT be the issue.
The alternative might need to be to create a second date field, where you can use the WordPress autosave function to take the date that the plugin stores, and re-format that and save it into this second field in the correct format. This post should give you some ideas on that (this example save only the year, but the idea is the same):
https://support.searchandfilter.com/forums/topic/datefilter/page/3/#post-238869
Anonymous(Private) August 7, 2020 at 2:38 pm #255376Hi Trevor,
We have looked into to your solution and have made a small test that will work.
I changed those values in the meta for testing purposes.
We will indeed take the foo events dates, translate them to YYYYMMDD and store it in a new custom field and then search for that using post meta.
Let us make sure this has worked, and have it working on the live site before closing the topic.
I will then remove your temp account on the site.
Cheers
-
AuthorPosts