1

I'm using Solspace calendar on my EE site to handle calendar events. I am also using the built in simple search for the search feature on my site. I would like to have the search include calendar events in possible results, but only if the event has not passed already. I don't see any way to do that with the simple search, unless I can set the calendar events to automatically expire after they pass. Does anyone know of a way to either auto-expire calendar events after they pass, or is there a different search module I can use that would take into account the end date for an event based on how Solspace calendar tracks them (start date/end date, etc.)

Thanks,

Brian

1 Answer 1

3

Calendar events do not use regular entry entry_date and expiration_date values, but rather specialized event data stored in Calendar itself. Since the EE simple search form uses the regular EE channel entries library, it won't be able to filter for upcoming events based on entry_date and expiration_date.

Further, occurrences of an event are not necessarily channel entries themselves (unless you edit one of the occurrences, in which case only that occurrence becomes an entry). The EE simple search module will therefore not be able to display separate occurrences as if they were entries, even less discern upcoming occurrences.

To display upcoming events (another way of saying "events that have not passed yet"), you'll need to use {exp:calendar:cal}. You could try feeding the {entry_id} from your search results into a tag starting like this:

{if channel_short_name == "calendar_events"}
  {exp:calendar:cal 
      pad_short_weeks="n"
      date_range_start="today"
      date_range_end="+1 month"
      event_id="{entry_id}"
  }
    // ...more code
  {/exp:calendar:cal}
{/if}

This will display, within your search results, all occurrences in the coming month for that event entry. As a note, if you're ordering your regular results by entry entry_date or expiration_date, these occurrences won't "mix in" chronologically with your other regular channel entries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.