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.
-
AuthorPosts
-
June 28, 2016 at 6:09 am #1132835
Manuela Hernandez Perez
ParticipantHi,
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!June 28, 2016 at 4:46 pm #1133217Nico
MemberHi 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,
NicoJune 29, 2016 at 12:00 am #1133298Manuela Hernandez Perez
ParticipantThis reply is private.
June 29, 2016 at 12:46 am #1133312Manuela Hernandez Perez
ParticipantI 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?
June 30, 2016 at 1:22 pm #1134187Nico
MemberThanks 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,
NicoJune 30, 2016 at 1:31 pm #1134196Manuela Hernandez Perez
ParticipantThank 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?
July 1, 2016 at 4:40 pm #1134684Nico
MemberSorry 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,
NicoJuly 2, 2016 at 4:43 am #1134766Manuela Hernandez Perez
ParticipantThank 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!!July 5, 2016 at 3:55 pm #1135789Nico
MemberThanks 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,
NicoJuly 5, 2016 at 11:05 pm #1135862Manuela Hernandez Perez
ParticipantWow, Nico, it is perfect ๐ Thank you so much!
July 6, 2016 at 9:12 am #1135987Nico
MemberYou 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 -
AuthorPosts
- The topic ‘Modify which fields are displayed in the email ticket’ is closed to new replies.
