This is for a project in development so no url at this time. I am building a site that will have several vacation rental units. Each unit will have days where it's is booked and not available and other days that it is available. I'd like to be able to have an filter for date of arrival and date of departure and show the units that have all dates available in that range. This is similar to sites like Expedia where you put in your dates and it will return lodging that is available for those dates. Is this doable with Toolset? Toolset and another plugin? If there is some documentation of a forum thread on this already I'd appreciate a link. Thanks!
Hello. Thank you for contacting the Toolset support.
Basically - if you have start date and end date setup as custom field, you can add the those start and end date custom field as filters to your custom search view and it will return the results/posts that falls within the selected date range.
Thanks for the reply. I understand that would work if a unit had a date. But instead units have many dates that they are available for. For example For September the unit is available to be booked the 1st through the 15th of that month. But if somebody books it for the 2nd, & 3rd, those dates would no longer be available. So if a user were to search for Arriving the 1st and departing the 5th, the 2nd and 3rd wouldn't be available and so I wouldn't want the unit to show in that search. Is that doable? or would I need an additional plugin, or will this require custom coding? If custom coding, are there hooks, or developer docs? Thanks.
So - the example you gave here applies to single unit search.
Basically, using View/Blocks you can add custom date filter as text, date-picker. Where there is no control over as it will simply allow the user to select the dates and based on the selected date it will filter the results.
Do you want to create search for single unit or multiple units?
Because - if you go for multiple units - lets consider all of the following units are available to be booked the 1st through the 15th of that month.
- Unit A - is booked for the 2nd, & 3rd
- Unit B - is booked for the 4th, & 5th
- Unit C - is booked for the 7th, & 8th
- Unit D - is booked for the 9th, & 10th
- Unit E- is booked for the 11th, & 12th
nor, if user search for Arriving the 1st and departing the 5th. It should display:
- It should display only unit C,D and E - correct? If yes:
That mean you want to remove the Unites that is booked that falls within the search range from your search result. Correct? If yes:
You need to run a add-on query using the view's filter hook wpv_filter_query, where you should search the Units that falls in the selected search range and add those found post's post ID as post__not_in query argument.