verbb / events

Craft CMS Plugin for events management and ticketing.
Other
22 stars 13 forks source link

Displaying events and tickets based on the current user #71

Closed kevadamson closed 3 years ago

kevadamson commented 4 years ago

Sorry for being a dumbass, but what is an example of the twig syntax required for listing event / ticket details based on the current user logged in and what they have purchased?

engram-design commented 3 years ago

Have a look at https://verbb.io/craft-plugins/events/docs/getting-elements/event-queries#customer

{# Fetch events that have been purchased by a customer #}
{% set events = craft.events.events()
    .customer(craft.commerce.getCarts().getCart().customer)
    .all() %}

and https://verbb.io/craft-plugins/events/docs/getting-elements/ticket-queries#customer

{# Fetch tickets that have been purchased by a customer #}
{% set tickets = craft.events.tickets()
    .customer(craft.commerce.getCarts().getCart().customer)
    .all() %}
kevadamson commented 3 years ago

I get "Calling unknown method: craft\commerce\Plugin::getCart()" error ...

engram-design commented 3 years ago

Sorry, the docs required updating - I have edited me previous post