Payment method Column on Bookings Screen

WordPress Event Management, Calendars & Registration Forums General Question Payment method Column on Bookings Screen

This topic contains 6 replies, has 3 voices, and was last updated by  Stephen Harris 9 months, 3 weeks ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #26286

    Hi Stephen,

    Huge fan of your plugin, in fact we’ve just purchased a 7th license!

    Quick question – one client has offline payments enabled in addition to PayPal, but when they’re viewing all bookings via the dashboard there’s no way to tell which are offline payments – (so they know which bookees to chase for payment).

    Do you have a quick snippet to add an admin column on the bookings page, to indicate payment method?

    Thanks in advance,
    Chris

    Chris Dunst
    #26295

    Hi Chris,

    Glad you like the plug-in :). Here’s a snippet that will do just that:

    add_filter( 'manage_event_page_bookings_columns', function( $columns ) {
        $columns['gateway'] = 'Gateway';
        return $columns;
    }, 20 );
    
    add_action( 'eventorganiser_booking_table_column', function( $column, $booking ) {
        if ( 'gateway' !== $column ) {
            return;
        }
        echo esc_html( eo_get_booking_meta( $booking->ID, 'gateway' ) );
    }, 10, 2 );
    
    Stephen Harris
    #26310

    Worked great, thanks!

    Chris Dunst
    #42862

    Hi Stephen
    This snippet still works, thanks. It doesn’t add the gateway column to the CSV though. Is it possible to also add it there?

    Thank you!

    Oliver Flueckiger
    #42875

    Yes, here is a snippet for adding it to the bookings export (a similar filter exists for tickets export):

    add_filter( 'eventorganiser_export_bookings_headers', function( $columns ) {
        $columns['gateway'] = 'gateway';
        return $columns;
    } );
    
    add_filter('eventorganiser_export_bookings_cell_mycustomcolumn', function( $cell, $booking ) {
        return eo_get_booking_meta( $booking->ID, 'gateway' )
    }, 10, 2 );
    
    Stephen Harris
    #42878

    Hi Stephen
    Thanks!
    It correctly adds the column “gateway” to the CSV file, but the cells are empty. Can you please double-check?
    Btw, there’s a semicolon missing:

    return eo_get_booking_meta( $booking->ID, 'gateway' )**;**
    
    Oliver Flueckiger
    #42928

    Sorry Oliver I didn’t see this reply. The key of the $columns array must match the suffix of the filter used to return the cell content. Here’s a corrected and tested version:

    add_filter( 'eventorganiser_export_bookings_headers', function( $columns ) {
        // this key must match the suffix to 
        // the eventorganiser_export_bookings_cell_<suffix> hook below
        $columns['mycustomcolumn'] = 'gateway';
        return $columns;
    } );
    
    add_filter('eventorganiser_export_bookings_cell_mycustomcolumn', function( $cell, $booking ) {
        return eo_get_booking_meta( $booking->ID, 'gateway' );
    }, 10, 2 );
    
    Stephen Harris
Viewing 7 posts - 1 through 7 (of 7 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.