Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Make search by two date fields [from] … [to] results match when overlapping
This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko 3 years, 4 months ago.
- AuthorPosts
- July 15, 2020 at 11:54 am #28484
Hi Ernest,
having a travel agency website with the following criteria:
each travel offer has two custom fields (acf date picker), ‘from’ and ‘to’;
administrator sets a period of time during which the offer is available – i.e. from 20 July to 15 August;having a ASP search fieldset, like the followin:
[text search field] – [date ‘from’] – [date ‘to’]at this very moment, search results match only the offers whose from-to dates are within the dates the user sets.
For example:
user sets “calabria” – from: 30 July to: 31 August
offer “Pizzo Calabro” having fields from: 2 August to: 29 August – DOES MATCH and show in results
offer “San Teodoro” from: 1 Sept to: 16 Sept – DOES NOT MATCH
offer “Happy Holiday” from: 28 July to: 15 August – DOES NOT MATCH
offer “Villaggio Calabro” from: 18 August to: 6 Sept – DOES NOT MATCHWhat I’m trying to do:
I would let the results showing any offer whose time period from-to just overlaps the period the user sets.
Using the example above, I would like to have results behaviour like the following:user sets “calabria” – from: 30 July to: 31 August
offer “Pizzo Calabro” having fields from: 2 August to: 29 August – DOES MATCH and show in results
offer “San Teodoro” from: 1 Sept to: 16 Sept – DOES NOT MATCH
offer “Happy Holiday” from: 28 July to: 15 August – DOES MATCH and show in results – it’s overlapping
offer “Villaggio Calabro” from: 18 August to: 6 Sept – DOES MATCH and show in results – it’s overlappingIs this feasible with just some configuration?
I tried using “show results before / after the date inclusive“, but doesn’t look the right way?
Is there an other way via code, modifing the query filtering maybe? In this case, also a tip in the right direction, would be much appreciated.Thanks in advance.
Patrizio
July 15, 2020 at 1:39 pm #28491Hi Patrizio,
Well, you can try to change the logic between the custom field filters matching here. That will sort of do the trick.
Best,
This would be far more complicated via custom code, I’m not sure if I can recommend anything.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.