• Resolved werkgroepinternet

    (@werkgroepinternet)


    I’m trying to alter the output of bookings-event-printable.php.

    With `<?php
    foreach($bookings as $EM_Booking) {
    ?>
    <tr>
    <td><?php echo $EM_Booking[‘person_name’] ?></td>
    <td><?php echo $EM_Booking[‘person_email’] ?></td>
    <td><?php echo $EM_Booking[‘person_phone’] ?></td>
    <td class=’spaces-number’><?php echo $EM_Booking[‘booking_space’] ?></td>
    <td><?php echo $EM_Booking[‘booking_comment’] ?></td>
    </tr>`
    I get my bookings on alphabetical order.

    With `<?php foreach($EM_Booking->get_tickets_bookings() as $EM_Ticket_Booking): ?>
    <?php /* @var $EM_Ticket_Booking EM_Ticket_Booking */
    echo $EM_Ticket_Booking->get_ticket()->name;
    ?><br><?php endforeach; ?>`
    I get a list of attendees with their corresponding tickets on order of date and time they bought the ticket.

    Is it possible to combine these codes? So I can have a list of attendees with the corresponding tickets they bought? Many thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • caimin_nwl

    (@caimin_nwl)

    It should work if you nest the second code block within the first.

    Thread Starter werkgroepinternet

    (@werkgroepinternet)

    OMG. It is done. Thanks for the suggestion, it was a bit harder than just nesting the block under it, but nevertheless: this has become the code.

    
    <?php 
    	$bookings = array();
    	foreach($EM_Event->get_bookings()->bookings as $EM_Booking){
    		if ($EM_Booking->status == 1){
    			array_push($bookings, array('person_name'=>$EM_Booking->person->get_name(),'person_email'=>$EM_Booking->person->user_email,'person_phone'=>$EM_Booking->person->phone,'booking_space'=>$EM_Booking->get_spaces(),'booking_comment'=>$EM_Booking->booking_comment,'Tickets_Bookings'=>$EM_Booking->get_tickets_bookings()));
    		}
    	}
    	asort($bookings);
    ?>
    
    <?php
    	foreach($bookings as $EM_Booking) {
    ?>
    <tr>
    	<td class="Name"><?php echo $EM_Booking['person_name'] ?></td> 
    	<td><?php echo $EM_Booking['person_phone'] ?></td>
    	<td class="Ticket"><?php foreach($EM_Booking['Tickets_Bookings'] as $EM_Ticket_Booking){ echo $EM_Ticket_Booking->get_ticket()->name ; ?> <br> <?php } ?></td>
    	<td class="Comment"><?php echo $EM_Booking['booking_comment'] ?></td> 
    </tr>
    <?php 
        } 
    ?>
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Alphabetical list of attendees with names of tickets they bought’ is closed to new replies.