Modify which fields are displayed in the email ticket

Home Forums Ticket Products Event Tickets Plus Modify which fields are displayed in the email ticket

  • This topic has 11 replies, 3 voices, and was last updated 9 years, 9 months ago by Manuela Hernandez Perez.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1132835

    Hi,
    I need to remove the ticket name from the email ticket. Instead of it a specific custom field should be displayed. How can i do this?
    Thank you in advance!

    #1133217
    Nico
    Member

    Hi Manuela,

    Thanks for reaching out to us! I’ll help you here…

    To modify the tickets email you’ll need to create a template override of the file /wp-content/plugins/event-tickets/views/tickets/email.php. Be sure to check the details on how to do so in themer’s guide!

    Please let me know if you can make it work,
    Best,
    Nico

    #1133298

    This reply is private.

    #1133312

    I sent you a private message with the password. I need to know the strings for the label and the text field content of the custom field “Teilnehmer”. Can you please help me?

    #1134187
    Nico
    Member

    Thanks for following up Manuela!

    To get that custom field we need to know the key assigned to the field. To reveal that key please temporarily add the following code to your theme (or child theme) functions.php file:


    /* Show additional fields meta key */
    function tribe_show_key_fields ( ) {
    $fields = tribe_get_custom_fields();

    $fields = get_post_meta( get_the_ID() );

    foreach ( $fields as $name => $value ) {

    if ( strrpos ( $name ,'_ecp_custom_' ) !== false ) {
    echo 'Field: ' . $name . ' = ' . $value[0] . ' <br/>';
    }
    }
    }

    add_action ( 'tribe_events_single_event_before_the_meta', 'tribe_show_key_fields' );

    Once the code is in place, visit the single event page that actually has a value for the custom field “Teilnehmer”. You’ll see the meta keys before the actual meta section of the single event (https://cloudup.com/c6q5dlkaPB0). Once you know the meta key remove the code you added to functions and use the following code to get the value of the field in the template:


    $value = get_post_meta ( $event_id, THE_META_KEY, true );

    Please give that a try and let me know if it works for you,
    Best,
    Nico

    #1134196

    Thank you, but after copying this code to functions.php I got the http error 500. Luckily I could replace the file by a backed up version via FTP. Was sth wrong with it?

    #1134684
    Nico
    Member

    Sorry to hear Manuela…

    Just be sure to paste it at then end of the file and check that php tag is open (basically that there’s no ?> before you paste the code in). I re-tried the code in my local install and it’s working as expected. Can you try to re-paste the code from this Gist instead? Maybe there was an enconding issue?

    https://gist.github.com/niconerd/35c2f1cf72acee927cabf7d647150ea2

    If the problem persists can you please the log for any errors?

    Have a great weekend,
    Nico

    #1134766

    Thank you, Nico! I got the key now: _ecp_custom_15
    Still I don’t know how to get the meta field content into the email.php file.
    I need that the ticket name information is completely removed, and in the next row between the venue and the organizer names should be the meta field “Treffpunkt” information, like shown here:
    http://prntscr.com/bnusum
    Thanks a lot again!!

    #1135789
    Nico
    Member

    Thanks for the key Manuela!

    Below you’ll find a sample email template override file that addresses your requirements (please note that table styles might need an adjustment):

    https://gist.github.com/niconerd/6db8cc4fb5aa7e465811ea70b32714d4

    Please try the file out and let me know if it works for you,
    Best,
    Nico

    #1135862

    Wow, Nico, it is perfect ๐Ÿ™‚ Thank you so much!

    #1135987
    Nico
    Member

    You are welcome Manuela! Glad to be of service ๐Ÿ™‚

    Iโ€™ll go ahead and close out this thread, but if you need help with anything else please donโ€™t hesitate to create a new one and we will be happy to assist you.

    Best,
    Nico

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Modify which fields are displayed in the email ticket’ is closed to new replies.