I am really struggling to get the Solspace Calendar Module to do something that seems to me would be a fairly common requirement.
Use Case
- I have a travel site which is centered around package tours, and I've created calendar events for each tour's departure schedule.
- Tour departure events are multi-day, and have repeat rules to determine when the subsequent 'occurrences' will be scheduled.
- Typically a given tour could have a range of departures that starts in say, January, and ends in December.
I need to output the following
- day-by-day calendar template
- listing tour departures ('occurrences') for each day, for the next month or so.
- I do not want to show multi-day occurrences that already started as this is not useful information for someone who wants to join a tour at the point of departure.
- I would prefer not to use in-template conditionals to filter out occurrences that already started, because I'm dealing with a lot of data - over 300 tours with 5-50 occurrences for each - and this will be resource intensive, as well as pretty clumsy.
What I've tried
{exp:calendar:cal} template tag (and all other template tags) - eg:
{exp:calendar:cal date_range_start="tomorrow" pad_short_weeks="n" date_range_end="1 month" first_day_of_week="1"}
{display_each_day} output occurrence start dates here {/display_each_day}
{/exp:calendar:cal}
- Fails because it kicks out all occurrences that are in progress on the day specified, rather than just the occurrences that start on the day specified. So I'm seeing events that started before the date range, but are still in progress. Some tours are as long as 56 days, so results will be way out for a daily departure listing.
Custom Query - I was sure this would solve it, but no joy so far.
SELECT exp_channel_titles.title AS t_title, exp_channel_data.entry_id AS d_entry_id FROM exp_calendar_events_occurrences
LEFT JOIN exp_calendar_events ON exp_calendar_events_occurrences.event_id = exp_calendar_events.event_id LEFT JOIN exp_channel_titles ON exp_calendar_events_occurrences.entry_id = exp_channel_titles.entry_id LEFT JOIN exp_channel_data ON exp_channel_titles.entry_id = exp_channel_data.entry_id WHERE exp_calendar_events_occurrences.start_date = '{date format="%Y%m%d"}' AND exp_calendar_events_occurrences.calendar_id = '887'- this fails because the exp_calendar_events_occurrences table does not appear to actually contain all occurrences. I'm guessing event rules are used by the module to output repeat occurrences that do not appear with this approach.
{exp:calendar:cal}
might be good, and I can elaborate in an answer (sorry, might require a conditional).