Home › Forums › Ticket Products › Event Tickets Plus › Event details in cart, checkout and emails sent
- This topic has 13 replies, 2 voices, and was last updated 7 years, 11 months ago by Barry.
-
AuthorPosts
-
April 13, 2016 at 5:41 am #1101869VivianneParticipant
I searched the forum but I couldn´t solve my problem with the posts I found.
I need following event details in the cart, the checkout and all the emails sent:
– Event title
– Event start date and time
– Event venue and cityHow can I integrate this?
I already tried the solution mentioned here (https://theeventscalendar.com/support/forums/topic/display-event-details-in-woo-cart/) but it added nothing to my cart.
Can you help me here?
April 14, 2016 at 6:48 am #1102406BarryMemberHi Vivianne,
Thanks for getting in touch.
The topic you linked to is approximately 3 years old and related to a much earlier version of one of our ticketing plugins, so I’m not too surprised it didn’t work 😉
To achieve what you want you will definitely need to do some custom coding – and it is going to mean customizing the output not only of our plugin(s) but of WooCommerce, too, so for some elements of this work you may need to refer to their documentation or connect with their support team.
Before we go any further, though, I notice that you appear to have two valid license keys at present but neither relate to Event Tickets Plus (nor to our legacy WooTickets plugin). Did you purchase a support key for one of those plugins under a different account? Would it be possible for you to login using that account instead?
Thanks!
April 14, 2016 at 6:57 am #1102409VivianneParticipantThis reply is private.
April 14, 2016 at 7:09 am #1102423BarryMemberHi Vivianne,
Thanks for clarifying 🙂
So the essence of this is that in most of the views/emails you referred to you will be able to obtain the product ID. For example, within WooCommerce’s cart/cart.php template you can grab it using $cart_item['product_id'] – from there, you can use various template tags and helper functions we provide to obtain the data you are interested in.
- tribe_events_get_ticket_event() will accept the product ID and return the associated event object (if there is one)
- You can then obtain the event ID and make use of standard WordPress functions like get_the_title()
- To access specific pieces of event and venue data you can use various helpers we provide such as tribe_get_start_time(), tribe_get_address() and tribe_get_city()
In terms of injecting this data into the templates in question you could either use template overrides or suitable action hooks – but since it sounds like most of the areas you want to customize are on WooCommerce’s side I’d encourage you to familiarize yourself with their code and documentation before settling on an approach.
Does that help?
April 14, 2016 at 7:11 am #1102426VivianneParticipantI have to try this.
When we decided for the plugins we thought something like this is included as a standard.
I guess there are a lot of people who need this exact details in the emails etc.I will get back to you if I am stuck.
Thanks a lot for the first input.
April 14, 2016 at 8:06 am #1102466BarryMemberSounds good, Vivianne.
When we decided for the plugins we thought something like this is included as a standard.
The main tickets email should indeed provide this information to your customers – but we don’t feel that everyone would wish to add this to the cart, checkout and receipt.
That said, you are welcome to post feature requests detailing what you would like to see (and/or upvote or comment on existing feature requests like this one).
Thanks again!
April 14, 2016 at 12:42 pm #1102686VivianneParticipantI tried to understand all you have written, but I cannot figure out, how this special code would look like.
Could you make an example please?
We need to go live next week and I am stuck here with this request of the client.April 14, 2016 at 1:35 pm #1102719BarryMemberHi Vivianne,
So within the cart template (and in the portion where $cart_item['product_id'] has been defined) you might do something like this:
$event = tribe_events_get_ticket_event( $cart_item['product_id'] ); if ( ! empty( $event ) ) { echo get_the_title( $event->ID ); echo tribe_get_address( $event->ID ); }
Of course, you’d need to add formatting etc – but hopefully that gives you a better idea of the form your code might take?
April 19, 2016 at 3:56 am #1104137VivianneParticipantI tried your code and I was able to add the title. (After changing tribe_events_get_event_ticket to tribe_events_get_ticket_event)
Trying to go for the rest now… 😉- This reply was modified 7 years, 11 months ago by Vivianne.
April 19, 2016 at 6:57 am #1104192VivianneParticipantI was able to add all the details to my cart, checkout and overview-page.
In the emails this method doesn´t work. It adds the page-title instead of the event-title and the actual date/time instead of date/time of the event.Could you help me once more?
I added this code to the file email-order-items.php in the woocommerce folder.$event = tribe_events_get_ticket_event( $cart_item['product_id'] ); echo '<br><span class="name">'. tribe_get_events_title( $event->ID ) . '</span>'; echo '<br><span class="date">'. tribe_get_start_date( $event->ID ) . '</span>'; echo '<br><span class="venue">'.tribe_get_venue( $event->ID ).', <span>'. tribe_get_city( $event->ID ). '</span></span>';
April 19, 2016 at 7:12 am #1104199BarryMemberSorry for the mixup and thanks for pointing that out, I have now updated the snippet 🙂
With regards to the email template you’re right, that won’t work there because $cart_item isn’t defined – that was just an example to get you started and was specific to the cart/cart.php template.
However, you should be able to follow effectively the same process – only this time you would obtain the product ID by using $_product->id (within the foreach loop you see there).
Does that help?
April 19, 2016 at 7:15 am #1104201BarryMember…As a sidenote, it looks like you have also removed the if ( ! empty( $event ) ) {} test. If there is any potential for you to sell a ‘mixed cart’ containing not only tickets but unrelated products, I’d advise restoring that 🙂
April 19, 2016 at 7:18 am #1104204VivianneParticipantIt works now! You are amazing!
Thanks a lot!You are right with your sidenote:
I removed it in my try & error status to get it working. 😉
It´s back there now.April 19, 2016 at 9:29 am #1104329BarryMemberAwesome!
I’ll go ahead and close this topic but of course please don’t hesitate to post new topics as needed if anything else crops up – one of the team will be only too happy to help 🙂
-
AuthorPosts
- The topic ‘Event details in cart, checkout and emails sent’ is closed to new replies.