Home › Forums › Ticket Products › Event Tickets Plus › insert ticket field set with ur snippet on email don’t work
- This topic has 12 replies, 5 voices, and was last updated 9 years, 5 months ago by
Sallé Alexander.
-
AuthorPosts
-
October 5, 2016 at 5:51 am #1172652
Sallé Alexander
Participanthello,
i use this snippet below to insert the fields on the the ticket send by mail but it doesn’t work for me,
maybe, its my slug name are wrong ( where can i find it ?
//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 '
Course Participants
';
foreach( $fieldset_meta AS $item => $value ) {
foreach( $fieldset_meta[$item] AS $key => $value ) {
$att_fname = (isset( $value['prenom'] )) ? $value['prenom'] : '';
$att_lname = (isset( $value['nom'] )) ? $value['nom'] : '';
$att_email = (isset( $value['email'] )) ? $value['email'] : '';
$att_phone = (isset( $value['telephone'] )) ? $value['telephone'] : '';
$att_profession = (isset( $value['profession'] )) ? $value['profession'] : '';
$att_license = (isset( $value['license'] )) ? $value['license'] : '';echo '
';
echo 'Attendee - '. $cnt .'
';
echo 'Name: '. $att_fname .' '. $att_lname .'
';
echo 'Email: '. $att_email .'
';
echo 'Phone: '. $att_phone .'
';
echo 'Profession: '. $att_profession .'
';
echo 'License #: '. $att_license .'
';
echo '';
$cnt++;
}
}
}
all the best
alexender
October 7, 2016 at 6:41 am #1173692Nico
MemberHey Alexander,
The code looks good to me! I just tried it out (made some minor tweaks) and instead of printing out each field I added a simple var_dump. This way you’ll be able to see the field labels:
https://gist.github.com/niconerd/b31da56a2c5a96b04079254c59d0bb00
Please let me know if this works for you,
Best,
NicoOctober 10, 2016 at 2:53 am #1174414Sallé Alexander
Participanthello,
yes it work but there is “array’ and “string” displayed…
is it possible to have only the field like this : prenom: bb
i send u a screenshot.
all the best
Alexander
October 10, 2016 at 2:54 am #1174416Sallé Alexander
Participantthe screenshot
October 11, 2016 at 7:09 pm #1175196Nico
MemberSure that’s possible Salle!
Just replace the keys who had there for the correct ones that the output showed:
Prenom: <?php echo $value['prenom']; ?>
Does that work for you? Have you tried enabling the commented code?
Please let me know about it,
Best,
NicoOctober 26, 2016 at 4:55 am #1183091Shaun
ParticipantHi,
I’m looking to do the same here and have added the amended code from Nico. Thanks to you and also Sallé for the original code.
However, I’m just getting the full var_dump including the array/string.
I don’t really understand exactly what I need to replace from the commented out code to just show the field label/value.
My fieldset is very simple just two fields; attendee name and email address.
‘name-of-attendee’ and ’email-address-of-attendee’ (screenshot attached)
I would be very grateful if somebody could tell me what to change in this code to make it show up in the email just like the ‘Customer Details’ do below.
echo '<h3>Attendee Info</h3>'; foreach( $fieldset_meta AS $item => $value ) { foreach( $fieldset_meta[$item] AS $key => $value ) { echo '<strong>Attendee - '. $cnt .'</strong><br />'; echo '<pre>'; var_dump( $value ); echo '</pre>'; /*$att_fname = (isset( $value['prenom'] )) ? $value['prenom'] : ''; $att_email = (isset( $value['email'] )) ? $value['email'] : ''; echo '<p>'; echo '<strong>Attendee - '. $cnt .'</strong><br />'; echo 'Name: '. $att_fname .'<br />'; echo 'Email: '. $att_email .'<br />'; echo '</p>';*/ $cnt++; } }Thanks in advance.
October 26, 2016 at 1:28 pm #1183385Nico
MemberHey Shaun,
Thanks for chiming in! Try this version, which should output the values:
foreach( $fieldset_meta AS $item => $value ) {foreach( $fieldset_meta[$item] AS $key => $value ) {
echo 'Attendee - '. $cnt .'
';
echo 'Name: ' . $value['name-of-attendee'] . '
';
echo 'Email: ' . $value['email-address-of-attendee'] . '
';$cnt++;
}
}
Please let me know if that works for you,
Best,
NicoOctober 27, 2016 at 4:34 am #1183641Shaun
ParticipantThanks Nico, that’s perfect!
October 27, 2016 at 9:53 am #1183902Nico
MemberGlad to hear Shaun 🙂
I’ll leave this thread open until Alexander confirm he could make it work in his site.
Cheers,
NicoOctober 28, 2016 at 12:46 am #1184283Sallé Alexander
Participanthello nico,
Is it possible to insert the title of the event for each if the user buy multiple ticket ?
all the best
Alexander
October 31, 2016 at 7:12 pm #1185566Nico
MemberHey Alexander, sure that’s possible just add the following lines in the existing snippet:
foreach( $fieldset_meta AS $item => $value ) {$event_id = get_post_meta ( $item, '_tribe_wooticket_for_event', true );
if ( !empty ($event_id ) ) echo get_the_title( $event_id );foreach( $fieldset_meta[$item] AS $key => $value ) {
That will echo the event title from which attendees are being fetched. You can move the $cnt = 1; above the new lines so the numbers correlate with each event.
Please let me know if this works for you,
Best,
NicoNovember 22, 2016 at 8:35 am #1195904Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘insert ticket field set with ur snippet on email don’t work’ is closed to new replies.
