Home › Forums › Ticket Products › Event Tickets Plus › Display "Attendee Information" on email confirmation
- This topic has 13 replies, 2 voices, and was last updated 9 years, 11 months ago by
Cliff.
-
AuthorPosts
-
April 20, 2016 at 3:12 am #1104739
Riccardo
ParticipantHi,
how can I insert the “Attendee Information” in the confirmation email if I set in the ticket?
thanksApril 20, 2016 at 3:29 pm #1105105Cliff
MemberHi.
At this time, our emails can only be customized via our Themer’s Guide.
If you need some coding help, you may want to ask your developer or reference our list of known customizers.
Let me know how things go for you.
April 21, 2016 at 6:47 am #1105321Riccardo
ParticipantHi Cliff PD,
so, how can I retrieve the attendee information?
there are some classes or function?
thanksApril 21, 2016 at 1:24 pm #1105632Cliff
MemberRiccardo, I’m not sure how much help this information will be, but you may want to look around here:
- /wp-content/plugins/event-tickets-plus/src/Tribe/Attendees_List.php
- /wp-content/plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Meta.php
- /wp-content/plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php –> possibly helpful: get_attendees()
Please let me know how things go for you.
April 22, 2016 at 6:15 am #1105857Riccardo
ParticipantHi Cliff,
in the files you list me there is not the function “get_attendees()”
So, how can I retrieve the Attendee Information I add in the ticket info?
thanksApril 22, 2016 at 8:59 am #1105932Cliff
MemberRiccardo, I’m sorry you’re unable to figure out your customization with the information I’ve provided; however, we’re limited in helping with customizations, per our Scope of Support / Terms.
If you make some progress and need a second pair of eyes to look at something, I may still be able to help with that if you provide your code and explain what about it is not working.
If you’d like, you can refer to our list of known customizers that I previously provided to you.
April 22, 2016 at 9:28 am #1105947Riccardo
ParticipantHi Cliff,
this is the code I do:add_action( 'woocommerce_email_order_details', 'kia_custom_order_details', 5, 4 ); function kia_custom_order_details( $order, $sent_to_admin, $plain_text, $email ){ if( $email->id != "customer_processing_order" ){ // retrieve items $items = $order->get_items(); foreach ( $items as $item ) { //recupero id del prodotto venduto - retrieve product id $product_id = $item['product_id']; //recupero id dell'ordine - retrieve order id $ordine_id = $order->id; $prova2 = get_post_meta($ordine_id, '_tribe_tickets_meta', true); foreach ($prova2 as $pette){ $nome_partecipante = $pette; foreach ($nome_partecipante as $merda){ echo $merda['nome-partecipante'].' - '.$merda['tempo-sul-giro'].' - '.$merda['cilindrata-moto'].'<br>'; } } } } }nome-partecipante – tempo-sul-giro – cilindrata-moto
are my attendee information for the ticket, but if this EVENT has more tickets, for example 2 tickets, I have a duplicate result:
partecipo – 1,45 – 9000
partecipo – 1,45 – 9000because the ticket in the events are two different but only one has a special fields.
how can I display only the information once?thanks
April 22, 2016 at 4:10 pm #1106154Cliff
MemberThanks for sharing your code. I see you have foreach twice, but I think you only need it once.
Please let me know how it goes.
April 24, 2016 at 7:34 am #1106407Riccardo
ParticipantHi Cliff,
the foreach twice is for the multidimensional array.
if I don’t I don’t have the datas.
Have you a suggestion?
thanksMy final target is retrieve the data for each ticket in the table summary.
thanksApril 25, 2016 at 8:19 am #1106645Cliff
MemberI meant to say that you have three foreach and that getting rid of the outermost foreach might help.
April 25, 2016 at 10:24 am #1106724Riccardo
ParticipantHi Cliff,
the first foreach is for the product in the order
the second foreach is for the meta of product
the third foreach is for the ATTENDEE INFORMATION in the meta of product.Where I am wrong ?
thanksApril 25, 2016 at 12:47 pm #1106783Cliff
MemberRiccardo, as stated before, this is custom coding territory. I’ll provide this last bit of help trying to assist you:
When your function is called, the order object is passed in. That’s all you need to get the ticket meta. For some reason, you’re looping through each order item and within that loop you’re grabbing and looping through the ticket meta.
So you’re going to see the ticket meta being repeated as many times as there are order items.
One other thought: you might be doing it this way to make it able to display each chunk of attendee metadata beside the relevant order item — if so, this isn’t the way to do it. You should separate the loop that gathers the attendee meta out.
If you need further coding help, you may want to ask your developer or reference our list of known customizers.
I hope this helps.
April 25, 2016 at 3:06 pm #1106835Riccardo
ParticipantHi Cliff,
thanks.
now the right code is it
thanksadd_action( 'woocommerce_email_order_details', 'kia_custom_order_details', 5, 4 ); function kia_custom_order_details( $order, $sent_to_admin, $plain_text, $email ){ // se email è non dell'utente che ha comprato la data if( $email->id != "customer_processing_order" ){ $course_date = null; // the loop : recupero gli oggetti comprati dall'ordine $items = $order->get_items(); //recupero id dell'ordine $ordine_id = $order->id; // recupero tutti i particolare del biglietto per poi trovare altri campi personalizzati $meta_ticket= get_post_meta($ordine_id, '_tribe_tickets_meta', true); // NOME PARTECIPANTE - TEMPO SUL GIRO - CILINDRATA MOTO //Array con nome partecipante $nome_partecipante = array(); //Array con tempo sul giro $tempo_sul_giro = array(); //Array con cilindrata moto $cilindrata_moto = array(); foreach ($meta_ticket as $info_ticket){ $info_ticket_fields = $info_ticket; foreach ($info_ticket_fields as $single_field){ $nome_partecipante[] = $single_field['nome-partecipante']; $tempo_sul_giro[] = $single_field['tempo-sul-giro']; $cilindrata_moto[] = $single_field['cilindrata-moto']; //chiudo il secondo foreach } // chiudo il primo foreach } //conto gli elementi dell'array $conta_numero_partecipanti = count($nome_partecipante); $conta_tempo_sul_giro = count ($tempo_sul_giro); $conta_cilindrata_moto = count ($cilindrata_moto); if (($conta_cilindrata_moto>0)&&($conta_numero_partecipanti>0)&&($conta_tempo_sul_giro>0)){ echo 'Ecco i dettagli dei biglietti: <br>'; for($indice=0; $indice<$conta_numero_partecipanti; $indice++){ echo ' <strong>Nome: </strong>'.$nome_partecipante[$indice].'<br> <strong>Tempo sul giro: </strong>'.$tempo_sul_giro[$indice].'<br> <strong>Cilindrata moto:</strong> '.$cilindrata_moto[$indice].'<br><br>'; } } // chiudo l'if } //chiudo la funzione }-
This reply was modified 9 years, 11 months ago by
Riccardo.
April 26, 2016 at 4:14 pm #1107427Cliff
MemberRiccardo, I’m very glad you finally got the code you needed.
Thanks for sharing for others to potentially benefit from too!
-
AuthorPosts
- The topic ‘Display "Attendee Information" on email confirmation’ is closed to new replies.
