Or Conditional on Collections Tag #7692
-
Hi there, I have a situation where I want to pull entries from an "events" collection for a particular location, so I want to filter the collection by something like However, I also want to show an events that have an event_type of "webinar", since webinars can be accessed from any location. Essentially I'm looking for something like this:
However I can't seem to get it to work that it only shows events that meet one or the other of those conditions. I have also tried just getting the entire events collection, and then immediately inside the collections tag to add another condition like so:
However in this scenario I then get an error Locations is just an array of IDs so I am unsure why the contains modifier is throwing an error. Any help appreciated. Cheers |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Did you look into Query Scopes ? |
Beta Was this translation helpful? Give feedback.
-
$query->whereJsonContains('locations', $values['location_id'])
|
Beta Was this translation helpful? Give feedback.
-
Awesome thanks!
On Wed, 15 Mar 2023 at 6:35 pm, Ryan Mitchell ***@***.***> wrote:
I couldn't figure out how exactly how to convert :locations:contains="id"
into a part of the Query Scope, so I just left that on the Collections tag
and then adjusted the Query Scope to give me what I want after that was
applied.
$query->whereJsonContains('locations', $values['location_id'])
{{ collection:events :location_id="id" query_scope="events_by_location" as="events" }}
—
Reply to this email directly, view it on GitHub
<#7692 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4VWDN5HVOVHBDPKPLN5JDW4F5NZANCNFSM6AAAAAAVZZQVYU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
[image: Where brands are built.] <https://htmlsig.com/t/000001FQ5N7T>
Mark Campbell0431 626 082
Where brands are built.
ply.studio
|
Beta Was this translation helpful? Give feedback.
Did you look into Query Scopes ?