Jump to content

Find future repeater items based on date


combicart
 Share

Recommended Posts

Hello,

I'm currently building an events website where one event can be in different locations. Each location can have it's own date. I therefore have added a repeater field called `event_locations` to an event where we can add more information about the location.

The `event_locations` repeater contains the following fields:

  • location (page reference)
  • event_date (datetime field)
  • event_price (text field)
  • event_link (url field)

On the event detail page I would like to show the different locations and sort them by date and city. Events in the past can be removed from the page.

I normally check the date with `event_date>=today` which works whenever I loop through all pages and filter by template. However in this case I would like to filter through the repeater field which doesn't give the same results for some reason.

This works (but displays all future event_locations):

$pages->find('event_date>=today, sort=event_date, sort=location.location_city')

This doesn't work (this give no results at all):

$page->event_locations->find('event_date>=today, sort=event_date, sort=location.location_city')

Can't the event_date be used in this case? Or is there a different way to get only events in the future for this specific event?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...