Support

Home Forums Event Espresso Premium Quantity of Guest Tickets

Quantity of Guest Tickets

Posted: July 12, 2019 at 12:04 pm


Nancy

July 12, 2019 at 12:04 pm

In https://eventespresso.com/topic/tracking-ticket-numbers/#post-295989 your concept of “…send a “number of guests” value to a custom field on the contact if they’re the primary attendee.” Will solve a counting issue in Infusionsoft. Can I get the code to take that Order number and put it into a custom field? (Order information from Infusionsoft is hard to pull – but if we can get this from Espresso – that would solve a big problem)

In Infusionsoft every custom field does get overwritten, but if we can get the code to populate a custom field (Guest ticket quantity for example) then we have the tools to take that number and do math on it into another field and then clear the original field. That would give us an easy way to reward individuals when they reach “x” guests brought to events, as a running total.


Josh

  • Support Staff

July 12, 2019 at 12:15 pm

Hi,

This code could be added to the code from the other topic:

if ($attendee->id() == $ee_attendee->id()) {
    $registrations = (array) $transaction->get_many_related('Registration');
    $is_contact_data['_NumberofGuests'] = count($registrations) - 1;
}

Please note in the above, the custom field’s name is “Number of Guests”. Also, the reason it subtracts 1 is because it’s going to return the number of guests, which is one less than the total number of tickets in the transaction.

The support post ‘Quantity of Guest Tickets’ 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