Skip to content

Instantly share code, notes, and snippets.

@jwcobb
Created June 24, 2013 21:50
Show Gist options
  • Save jwcobb/5853928 to your computer and use it in GitHub Desktop.
Save jwcobb/5853928 to your computer and use it in GitHub Desktop.
Fetch, filter, sort and display TicketGroups form Ticket Evolution API
// Set up the TicketEvolution webservice object
$tevoWebservice = new TicketEvolution\Webservice($cfg['ticketevolution']['params']);
/**
* Wrap the entire fetching/listing of tickets in a try/catch for safety
*/
try {
$options = array(
'event_id' => $eventId,
);
$allTicketGroups = $tevoWebservice->listTicketGroups($options);
if (count($allTicketGroups) <= 0) {
// No ticketGroups for this event
} else {
// Filter to just get tickets with a type of "event"
$eventTicketGroups = new TicketEvolution\Webservice\ResultSet\Filter\TicketGroups\Event($allTicketGroups);
// Sort the "event" ticketGroups
$sortOptions = array(
'retail_price' => SORT_ASC,
'section', // Defaults to SORT_ASC if neither is specified
'row' => SORT_DESC,
);
$eventTicketGroups->sortResults($eventTicketGroups);
// Loop through the event tickets
foreach ($eventTicketGroups as $eventTicketGroup) {
// Display a ticketGroup
echo $eventTicketGroup->section . '/' . $eventTicketGroup->row;
}
}
} catch (Exception $e) {
// Handle the error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment