Support

Home Forums Event Espresso Premium ESPRESSO_EVENT_ATTENDEES for multiple tickets purchased by one contact

ESPRESSO_EVENT_ATTENDEES for multiple tickets purchased by one contact

Posted: June 7, 2016 at 7:57 pm

Viewing 3 reply threads


Brad Crittenden

June 7, 2016 at 7:57 pm

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.

Would appreciate any help,
Brad


Josh

  • Support Staff

June 8, 2016 at 11:20 am

Hi Brad,

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.


Brad Crittenden

June 8, 2016 at 11:57 am

Hi Josh,

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.

Thx, Brad


Josh

  • Support Staff

June 8, 2016 at 12:57 pm

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:

https://eventespresso.com/wiki/useful-php-code-snippets/#attendee-list

Viewing 3 reply threads

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.

Event Espresso