I’m using the ESPRESSO_EVENT_ATTENDEES short tag to list tickets purchased for a specific event. My problem is that the code is actually listing each attendee once, even though some are purchasing multiple tickets for the event.
To clarify, there are three types of tickets available for a single event, and some attendees are purchasing more than one ticket type.
It looks like I need to modify the code to loop through all of the tickets for each attendee, but I have no idea how to code that.
The two templates in Event Espresso that generate the attendee list are:
loop-espresso_event_attendees.php
and
content-espresso_event_attendees.php
These can be copied over to your WordPress theme and customized.
In the loop- template, you’ll need to pass the $event object to the content- template, so where it has: EEH_Template::get_template_part( 'content', 'espresso_event_attendees', array( 'contact' => $contact, 'show_gravatar' => $show_gravatar ) );
You can change it to be: EEH_Template::get_template_part( 'content', 'espresso_event_attendees', array( 'contact' => $contact, 'show_gravatar' => $show_gravatar, 'event' => $event ) );
Then, inside the content- template, you can set a variable that has the number of tickets purchased for that attendee like this: <?php $group_size = $contact->get_most_recent_registration_for_event( $event->get('EVT_ID'))->get('REG_group_size') );?>
Then you echo out the $group_size variable where you want that number to be displayed.
Thank you for the reply. I read that in another post but it’s not quite what I need. Example, I’ve got an event with three ticket types, call them Tickets A, B and C. A person can purchase multiple tickets in separate transactions.
I need to be able to loop through all of the tickets (or transactions) purchased for all customers, something like this:
for all customers
for all tickets (or transactions)
print city, state and custom question
end all tickets
end all customers
There might be another way to do it but that’s what it looks like in my head 🙂
The current code for this tag is only giving me one transaction per customer.
It sounds like you want to print a name for each registration that was made. (A ticket sold is the equivalent to a registration). Here’s a link to a snippet that shows how to query those right from the database:
The support post ‘ESPRESSO_EVENT_ATTENDEES for multiple tickets purchased by one contact’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.