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 8 replies, has 3 voices, and was last updated by Robert Stankey 3 years, 8 months ago.
-
AuthorPosts
-
December 3, 2018 at 2:43 pm #32279
Hi Stephen,
we are using the Pro 2.0 BetaI have used the tutorial for attendee questions with the standard for as an example and have 2 problems.
-
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)
-
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 McErlaneDecember 5, 2018 at 10:46 pm #32293Hi,
Could you confirm whether the columns are missing or they are just empty?
Stephen HarrisDecember 6, 2018 at 9:27 am #32294The columns are there but the values are empty.
Sharon McErlaneDecember 11, 2018 at 10:26 am #32326Any 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 McErlaneMarch 21, 2021 at 4:29 pm #39462Did this issue get a final resolution? I took the example code verbatim from the original posting on Attendee Questions (https://wp-event-organiser.com/blog/tutorial/attendee-questions/) and have seen the same issue with respect to the columns being there in the booking view but the values are empty in it and anything exported.
Running:
– WordPress 5.6
– PHP 7.4
– Event Organiser 3.10.5
– Event Organiser Pro 3.1Thanks!
Robert StankeyMarch 23, 2021 at 10:38 pm #39479Hi Robert,
I can’t recall if the issue was resolved offline, but I’ve not been able to replicate the issue, having tested it just now.
To to debug this, if you echo a literal string in the callback hooked to
eventorganiser_booking_tickets_table_column
. Does it appear in the table? If not, then you’re callback is either not hooked correctly or otherwise not being called or the conditional'name' == $column_name
is never true (as taken from the blog post).If it does appear, then perhaps the data is missing from the database? Check the
eo_booking_ticketmeta
table, each entry should have aeo_booking_ticket_id
which corresponds tobooking_ticket_id
primary key in theeo_booking_tickets
table. That corresponding row will have abooking_id
so you an work backwards given a booking.Stephen HarrisMarch 24, 2021 at 12:29 am #39481Hi Steven,
The literal string I added in my eventorganiser_booking_tickets_table_column callback appears in the booking output screen.
For the ticketmeta entry, the meta_key shows “_eocid” and the meta_value shows “eoc1”. Not sure what this means.
Robert StankeyMarch 24, 2021 at 12:42 am #39483That’s just some internal metadata that’s used to map the attendee question responses to individual tickets. There should be an additional row for each attendee question. If not, then the data is missing. In the other forum thread I think I may have found the reason for that.
Stephen HarrisMarch 24, 2021 at 12:57 am #39486Hi Stephen,
It looks like you’ve solved my issue with the symptoms described. For those interested, in my case I had an entry form with custom fields and I only wanted those fields to be displayed in the bookings view for the events that used said entry form. This link provides more detail on what my issue was – https://wp-event-organiser.com/forums/topic/checkbox-required-option-not-working-in-attendee-questions/
Thanks!
Robert Stankey -
-
AuthorPosts