export ticket with tutorial for attendee questions not working

WordPress Event Management, Calendars & Registration Forums Report A Bug export ticket with tutorial for attendee questions not working

This topic contains 3 replies, has 2 voices, and was last updated by  Sharon McErlane 5 days ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #32279

    Hi Stephen,
    we are using the Pro 2.0 Beta

    I have used the tutorial for attendee questions with the standard for as an example and have 2 problems.

    1. when buying 2 tickets it asks for 3 name/email pairs in total , which are saved 3 times (I can see those in the booking)

    2. when exporting the tickets. I get 2 ticket lines which is good, but the ticket Holder name and email are empty.

    Can you please tell me what is wrong with the custom code ? Or is this linked to the Beta version ?

    Thanks

    <?php
    /*
    Plugin Name: Netoflight Event utility Plugin
    Description: All of the important functionality of your site belongs in this.
    Version: 0.1
    License: GPL
    Author: Nadia DA
    Author URI:
    */

    function my_attach_attendee_questions( $form ){

    //Define the field we want to add    
    $attendee_fields = array(
        array(
            'id'   => 'nol-jt-attendee-name',
            'type' => 'name',
            'required' => true,
        ),
        array(
            'id'   => 'nol-jt-attendee-email',
            'type' => 'email',
            'required' => true,
        ),
    );
    
    //The attendee-questions element acts as a 'holder' for the elements 
    //we want repeated for each ticket
    $attendee_questions = $form->get_element( 'attendee-questions' );
    
    //If it doesn't exist, we'll create it
    if ( ! $attendee_questions ) {
    
        $ticketpicker = $form->get_element( 'ticketpicker' );
        $position     = intval( $ticketpicker->get( 'position' ) ) + 1;
        $parent       = $ticketpicker->get_parent();
        $parent       = ( $parent ? $parent->id : false );
    
        //Create the attendee questions els
        $attendee_questions = EO_Booking_Form_Element_Factory::create(array(
            'id'           => 'attendee-questions',
            'type'         => 'attendee-questions',
            'elements'     => $attendee_fields,
            'ticket_label' => "Ticket: {{{ticketname}}}",
        ));
    
        //Add the attendee questions right after the ticket picker
        $form->add_element( $attendee_questions, array( 'at' => $position, 'parent' => $parent ) );
    
    } else {
        //Attendee questions field already exists, optional: over-ride with our elements
        $attendee_questions->set( 'elements', $attendee_fields );
        $attendee_questions->_modelElements->set( $attendee_questions->get('elements'), array( 'form' => $form ) );
    }
    

    }
    add_action( ‘eventorganiser_get_event_booking_form’, ‘my_attach_attendee_questions’, 5 );

    add_filter( ‘eventorganiser_export_tickets_headers’, function( $columns ) {
    $columns[‘ticket_first_name’] = ‘Ticket Holder (first name)’;
    $columns[‘ticket_last_name’] = ‘Ticket Holder (last name)’;
    $columns[‘ticket_email’] = ‘Ticket Holder Email’;
    return $columns;
    } );

    add_filter( ‘eventorganiser_export_tickets_cell’, function( $cell, $column, $ticket ) {

    switch( $column ){
    
        case 'ticket_first_name':
            $name = eo_get_booking_ticket_meta( $ticket->booking_ticket_id, '_eo_booking_meta_nol-jt-attendee-name' ); //_eo_booking_meta_{field id}
            return $name[0]; //$name is an array: array( 'first name', 'last name' );
            break;
    
        case 'ticket_last_name':
            $name = eo_get_booking_ticket_meta( $ticket->booking_ticket_id, '_eo_booking_meta_nol-jt-attendee-name' ); //_eo_booking_meta_{field id}
            return $name[1]; //$name is an array: array( 'first name', 'last name' );
            break;
    
        case 'ticket_email':
            return eo_get_booking_ticket_meta( $ticket->booking_ticket_id, '_eo_booking_meta_nol-jt-attendee-email', true ); //_eo_booking_meta_{field id}
            break;
    
        default:
            return $cell;
    }
    

    }, 10, 3 );

    add_filter( ‘eventorganiser_booking_tickets_table’, function( $columns ){
    $columns[‘name’] = ‘Ticket owner’;
    return $columns;
    });

    add_action( ‘eventorganiser_booking_tickets_table_column’, function( $column_name, $item ){
    if( ‘name’ == $column_name ){
    $name = (array) eo_get_booking_ticket_meta( $item->booking_ticket_id, ‘_eo_booking_meta_nol-jt-attendee-name’, false );
    echo implode( ‘ ‘, $name );
    }
    },10,2);

    Sharon McErlane
    #32293

    Hi,

    Could you confirm whether the columns are missing or they are just empty?

    Stephen Harris
    #32294

    The columns are there but the values are empty.

    Sharon McErlane
    #32326

    Any news on this please ???

    versions PHP 7.1 , wp 4.9.8

    Also I tested the same plugin on Pro 1.11.15 and there the ticket export works, but that version does not allow editing of bookee name and email , and doesn’t show the meta information (ticket info) when viewing the booking details.

    Sharon McErlane
Viewing 4 posts - 1 through 4 (of 4 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.