Home › Forums › Ticket Products › Event Tickets Plus › Custom ticket fields – Attendee information
- This topic has 17 replies, 5 voices, and was last updated 9 years, 7 months ago by
Josh.
-
AuthorPosts
-
July 20, 2016 at 10:08 am #1142009
Michael Shelton
ParticipantHow does one access the information stored in the attendee fields? I’m trying to trigger a discount based on the response to attendee questions and I’m not sure where these get stored are they custom fields or meta or what?
Any help in pointing me to the right direction would be great.
Thanks in advance.
July 20, 2016 at 7:18 pm #1142248Josh
ParticipantHey Michael,
Thanks for reaching out to us!
To clarify here, are you referring to accessing the values from the Ticket Fieldset responses provided by a user when purchasing a ticket?
Thanks!
July 20, 2016 at 8:46 pm #1142263Michael Shelton
ParticipantYes Josh, that’s exactly what I’m talking about 🙂
I wanted to have a radio button that if checked, I could discount the price of the ticket. This seemed like an easy way to apply an optional discount on a single ticket without disrupting the ticket count. Has this been done other ways or have you seen an easier way? I’m open at this point.
July 21, 2016 at 7:40 pm #1142795Josh
ParticipantHey Michael,
Thanks for following up here!
You should be able to grab that information from the form data (wouldn’t be stored anywhere directly at this point in the checkout process) when a ticket is added to the cart, however there would be several layers of customization there to grab the information and then compare and apply the discount that we wouldn’t be able to provide support for here in these forums.
Alternatively though, you could take advantage of the Global Stock feature here that should alleviate the ticket count issue you mention above.
Let me know if this helps.
Thanks!
July 27, 2016 at 2:12 pm #1144860Michael Shelton
ParticipantJosh, thank you for this, I saw the global stock feature and assumed I knew what it did without reading it 🙂 Shocking I know.
As a follow up. If I add a field as part of the “Ticket Fieldset” is there a way to include a brief description (sentence) in addition to the label for the input field? I figured I could put it in the event description but that ends up being too far away to help inform users of the significance of the field.
This article https://theeventscalendar.com/knowledgebase/collecting-attendee-information/ doesn’t expand on this much so I figured I’d ask… Thanks for all of the love and support.
July 29, 2016 at 7:29 am #1145531Josh
ParticipantHey Michael,
Thanks for following up here!
Unfortunately it doesn’t look like there is a simple way to add a description without some code customizations here.
To help get you pointed in the right direction here, are you planning on having multiple descriptions, multiple fields within a fieldset, or multiple fieldsets throughout the site?
Thanks!
July 30, 2016 at 6:06 am #1145815Michael Shelton
ParticipantHi Josh,
I just need one field and a description, and I want to use it on each event. There will be 5 events, each week and they are identical besides the date changes.
Thanks
-
This reply was modified 9 years, 8 months ago by
Michael Shelton.
July 30, 2016 at 6:19 am #1145818Michael Shelton
ParticipantSorry let me re-explain that.
We have 4 types of tickets.
Student/Military discount tickets and general admission are first come first serve and we have a total of 140, I used the global stock feature to account for those and this is working delightfully.
Next we have Tier 2 and Tier 1 each have their own number of total stock so these are independent, they differ in price as well. On these fields we allow people to add a “Group Name” so we can rope off sections of tier 2 or tier 1 seats to accommodate larger groups.
So every event, we have 2 ticket types that need the same single input field that simply asks if folks have a group name to associate with their order. We wanted to add this line of description next to “Group name? (optional)
If purchasing tickets separately, please provide a group name. Any reservations in the same tier using matching group names will be seated together.Thanks for the help!
August 1, 2016 at 6:25 am #1146053Josh
ParticipantHey Michael,
Thanks for following up here and clarifying!
Since the description will be the same anytime that you’re using the ticket fieldset feature, you can follow our Themer’s Guide to copy the template from the Event Tickets Plus plugin at src > views > meta.php into your theme. From there, you can add the description where you would like to display within that section.
Let me know if this helps.
Thanks!
August 1, 2016 at 11:47 am #1146217Jayson Cote
Participant@esthers525 If you’re interested, I have a code snippet here that will allow you to extract the ticket fieldset field data submitted with each ticket.
You will need to edit the field slug names to match your own field names, which you can see in the code identified between single quotes and square brackets. You will also need to get the order ID to return the correct values for that order. Depending on your planned usage there are several techniques to get the order ID and then hook or filter into the correct action in order to display or … with the ticket meta data.
The code below adds the ticket field values to the woocommerce customer email notice, although you can use the $fieldset_meta to get the values and do whatever you wish with them. Hope this helps.
//** Add fields to order emails - customer //add_action( 'woocommerce_email_customer_details', 'gum_woo_checkout_fields_email_customer' ); function gum_woo_checkout_fields_email_customer( $order ) { $fieldset_meta = get_post_meta( $order->id, Tribe__Tickets_Plus__Meta::META_KEY, true ); $cnt = 1; if (! $fieldset_meta ) return; echo '<h3> Course Participants </h3>'; foreach( $fieldset_meta AS $item => $value ) { foreach( $fieldset_meta[$item] AS $key => $value ) { $att_fname = (isset( $value['first-name'] )) ? $value['first-name'] : ''; $att_lname = (isset( $value['last-name'] )) ? $value['last-name'] : ''; $att_email = (isset( $value['email'] )) ? $value['email'] : ''; $att_phone = (isset( $value['phone'] )) ? $value['[phone'] : ''; $att_profession = (isset( $value['profession'] )) ? $value['profession'] : ''; $att_license = (isset( $value['license'] )) ? $value['license'] : ''; echo '<p>'; echo '<strong>Attendee - '. $cnt .'</strong><br />'; echo 'Name: '. $att_fname .' '. $att_lname .'<br />'; echo 'Email: '. $att_email .'<br />'; echo 'Phone: '. $att_phone .'<br />'; echo 'Profession: '. $att_profession .'<br />'; echo 'License #: '. $att_license .'<br />'; echo '</p>'; $cnt++; } } }August 2, 2016 at 7:08 am #1146502Josh
ParticipantHey Jayson,
Thanks for adding that information here! Looks like it could be very helpful!
Thanks!
August 10, 2016 at 12:37 pm #1150159Gergana
ParticipantHello All,
I will join in this thread with little different question. How can I include the custom ticket fields into the ticket and the order information in the administration console?
I have tried to include the given snippet by @gumwp into my theme function.php but at the end it gives me “Internal server error” when I am finalizing the purchase. I need to include this information because the event will offer a ticket for 2 persons. I am using the custom ticket fields for requesting information for the second person, but I cannot find the information from the custom fields usable. Could you please advise me how this can be done.@gumwpCould you please advise me where to include your snippet code in order to be working as you wrote 2 posts above in the thread.
Thank you for your time : )August 11, 2016 at 7:29 pm #1150788Josh
ParticipantHey Gergana,
Thanks for following up here. We typically request for additional requests that vary from the original post to open a new thread. However, I’ll leave this open in case there is any additional feedback.
However, snippets like this should be placed in your theme’s functions.php file. Sometimes, based on the configuration on the file, some people do find some difficulty in applying the snippets to their theme. If so, you can also try using a plugin like https://wordpress.org/plugins/code-snippets/ for adding those snippets.
Thanks!
August 15, 2016 at 8:47 am #1151670Jayson Cote
Participant@gergana I have updated the snippet for you. Simply place in your child theme functions.php file. FYI you will need to update the field slug names to be the same as the fields that you have created. The field slug name are indicated between the square brackets within the single quotation marks, i.e. [‘first-name’]
//** Display TEC ticket meta field value on the order admin page add_action( 'woocommerce_order_details_after_customer_details', 'gum_woo_ticket_fields_display_admin', 10, 1 ); function gum_woo_ticket_fields_display_admin( $order ) { // TEC ticket meta fields - get data $fieldset_meta = get_post_meta( $order->id, Tribe__Tickets_Plus__Meta::META_KEY, true ); //If No fields set, do not process if (! $fieldset_meta ) return; //If fields set, loop and display each tickets data for($i = 0; $i < count($fieldset_meta); $i++) { $att_ticket_title = get_the_title($keys[$i]); echo '<h4>'. $att_ticket_title .'</h4>'; foreach( $fieldset_meta[$keys[$i]] AS $key => $value ) { $att_fname = (isset( $value['first-name'] )) ? $value['first-name'] : ''; $att_lname = (isset( $value['last-name'] )) ? $value['last-name'] : ''; $att_email = (isset( $value['email'] )) ? $value['email'] : 'this'; $att_phone = (isset( $value['phone'] )) ? $value['phone'] : ''; $att_profession = (isset( $value['profession'] )) ? $value['profession'] : ''; $att_license = (isset( $value['license'] )) ? $value['license'] : ''; echo '<p>'; echo '<strong>Attendee - '. ($key + 1) .'</strong><br />'; echo 'Name: '. $att_fname .' '. $att_lname .'<br />'; echo 'Email: '. $att_email .'<br />'; echo 'Phone: '. $att_phone .'<br />'; echo 'Profession: '. $att_profession .'<br />'; echo 'License #: '. $att_license .'<br />'; echo '</p>'; } //end foreach } //end for } // end functionAugust 15, 2016 at 4:39 pm #1151863Gergana
ParticipantThank you Jayson,
This work great!. Now I have the attendee additional information in the tickets. I have one additional question: what do you mean by: “Display TEC ticket meta field value on the order admin page” Is that means it can be shown inside the order details or not?
-
This reply was modified 9 years, 8 months ago by
-
AuthorPosts
- The topic ‘Custom ticket fields – Attendee information’ is closed to new replies.
