• Resolved KramBie

    (@krambie)


    Is it possible to show x from y tickets are available on the booking form. Something like:

    It probably can be done by modifying the bookingform.php file (or the files it calls), but that is a bit beyond my PHP skills. Maybe there is another way I am overlooking.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter KramBie

    (@krambie)

    Well actually it is the file ticket-single.php and tickets-list.php, but still hard to do.

    You can do it without modifying the templates. Instead you can use the following code snippet to add another column to show the remaining spaces for each ticket type:

    add_action('em_booking_form_tickets_col_remaining', 'my_tickets_remaining', 10, 2);
    function my_tickets_remaining($EM_Ticket, $M_Event) {
    echo '<td class="em-bookings-ticket-table-remaining">' . $EM_Ticket->get_booked_spaces() . '/' . $EM_Ticket->get_spaces() . '</td>';
    }
    add_filter('em_booking_form_tickets_cols', 'my_em_booking_form_tickets_cols', 10, 2);
    function my_em_booking_form_tickets_cols($collumns, $EM_Event) {
    return [ 'type' => __('Ticket Type','events-manager'), 'price' => __('Price','events-manager'), 'remaining' => __('Remaining','events-manager'), 'spaces' => __('Spaces','events-manager') ];
    }

    You can use the Code Snippets plugin to add this code snippet.

    • This reply was modified 4 months, 1 week ago by joneiseman.
    Thread Starter KramBie

    (@krambie)

    Cool it works ??
    And just a few lines of code, well done. Again you learned me something new: How is hooking in in EM working. Not that I can write the code you did, that is still beyond my PHP skills, but I am learning.

    Thank you once again. You are a great help here and I am grateful. It helps me to get our site working as we want.

    Thread Starter KramBie

    (@krambie)

    Solved of course.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.