Display "Attendee Information" on email confirmation

Home Forums Ticket Products Event Tickets Plus Display "Attendee Information" on email confirmation

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1104739
    Riccardo
    Participant

    Hi,
    how can I insert the “Attendee Information” in the confirmation email if I set in the ticket?
    thanks

    #1105105
    Cliff
    Member

    Hi.

    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.

    #1105321
    Riccardo
    Participant

    Hi Cliff PD,
    so, how can I retrieve the attendee information?
    there are some classes or function?
    thanks

    #1105632
    Cliff
    Member

    Riccardo, 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.

    #1105857
    Riccardo
    Participant

    Hi 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?
    thanks

    #1105932
    Cliff
    Member

    Riccardo, 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.

    #1105947
    Riccardo
    Participant

    Hi 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 – 9000

    because the ticket in the events are two different but only one has a special fields.
    how can I display only the information once?

    thanks

    #1106154
    Cliff
    Member

    Thanks 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.

    #1106407
    Riccardo
    Participant

    Hi Cliff,
    the foreach twice is for the multidimensional array.
    if I don’t I don’t have the datas.
    Have you a suggestion?
    thanks

    My final target is retrieve the data for each ticket in the table summary.
    thanks

    #1106645
    Cliff
    Member

    I meant to say that you have three foreach and that getting rid of the outermost foreach might help.

    #1106724
    Riccardo
    Participant

    Hi 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 ?
    thanks

    #1106783
    Cliff
    Member

    Riccardo, 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.

    #1106835
    Riccardo
    Participant

    Hi Cliff,
    thanks.
    now the right code is it
    thanks

    add_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.
    #1107427
    Cliff
    Member

    Riccardo, I’m very glad you finally got the code you needed.

    Thanks for sharing for others to potentially benefit from too!

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Display "Attendee Information" on email confirmation’ is closed to new replies.