Home › Forums › Calendar Products › Events Calendar PRO › Need html code for purchased ticket info
- This topic has 9 replies, 3 voices, and was last updated 10 years, 1 month ago by
Support Droid.
-
AuthorPosts
-
February 4, 2016 at 1:05 am #1067402
Tommy
ParticipantHello. This is a specific questions but here it goes. I’m using WooCommerce with Events Calendar. So once someone buys a ticket or “product” so to speak, we can manually click the “process” button and it send out a “order processed” email to the customer from the WooCommerce plugin. I want to customise this further by adding the name of the ticket (or “product”) that the’ve purchased in that “processed” email.
Does anyone know how to do that? Is there some sort of “hook” or what ever you call it that i can add to the email html template that specifies what ticket they purchased?
February 4, 2016 at 3:11 pm #1067908Brook
ParticipantHowdy Tommy,
That email is sent by WooCommerce, and the template is part of Woo’s email templates. It can still be overriden and include more detail.
- How to override woo templates
- I believe the template you’re looking for is the “Customer: Completed order” one: woocommerce/templates/emails/customer-completed-order.php
You will notice that the details themselves are in the separate order details template, which is shared with a few other email templates. Inside of that template is yet another template, order items.
- woocommerce/templates/emails/email-order-details.php
- woocommerce/templates/emails/email-order-items.php
One of those is the template you wish to modify. It really depends on where you want the title. Likely it is in the order-items.php one.
If you wish to modify only the title, and do not mind modifying it in the email orders as well as the checkout screen, have a gander at this snippet:
https://gist.github.com/elimn/9352efba6accd9dc21a1
You could simply replace the usage of $event_start_date with $event_title. However, worth mentioning that there is a bug in the current version of Event Tickets Plus where tribe_events_get_ticket_event() does not actually work. 🙁 This is fixed in our next version 4.1. Or, you can fix it yourself by modifyingline 859 of /plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php and swapping this:
if ( in_array( get_post_type( $event ), Tribe__Tickets__Main::instance()->post_types ) ) {For this:
if ( in_array( get_post_type( $event ), Tribe__Tickets__Main::instance()->post_types() ) ) {Does that all make sense? Does that answer your question? Please let me know.
Cheers!
– Brook
February 4, 2016 at 7:16 pm #1067967Tommy
ParticipantThis reply is private.
February 10, 2016 at 8:41 am #1070905Brook
ParticipantHowdy Tommy,
I am sorry, I must not have been clear before. There is no code I shared that was meant to be copy/pasted into ‘customer completed order email’ template. I was sharing two separate solutions to your dilemma:
- How to create a theme override. This is the most customizable solution, but will require you to write your own code.
- A snippet that does something similar to what you want, and with a little tinkering can do exactly what you need. Paste the snippet at the top of your theme’s functions.php file. Replace the opening “<?php” with this snippet, as this snippet includes that opening tag.
1. Custom override
That email is sent by WooCommerce, and the template is part of Woo’s email templates. It can still be overriden and include more detail.
- How to override woo templates
- I believe the template you’re looking for is the “Customer: Completed order” one: woocommerce/templates/emails/customer-completed-order.php
You will notice that the details themselves are in the separate order details template, which is shared with a few other email templates. Inside of that template is yet another template, order items.
- woocommerce/templates/emails/email-order-details.php
- woocommerce/templates/emails/email-order-items.php
One of those is the template you wish to modify. It really depends on where you want the title. Likely it is in the order-items.php one.
2. Snippet
If you wish to modify only the title, and do not mind modifying it in the email orders as well as the checkout screen, have a gander at this snippet:
https://gist.github.com/elimn/9352efba6accd9dc21a1
You could simply replace the usage of $event_start_date with $event_title. However, worth mentioning that there is a bug in the current version of Event Tickets Plus where tribe_events_get_ticket_event() does not actually work. This is fixed in our next version 4.1. Or, you can fix it yourself by modifyingline 859 of /plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php and swapping this:
if ( in_array( get_post_type( $event ), Tribe__Tickets__Main::instance()->post_types ) ) {For this:
if ( in_array( get_post_type( $event ), Tribe__Tickets__Main::instance()->post_types() ) ) {Now that you know those are separate solutions does that help clarify things? Are you able to get it working, or could I perhaps clarify one of the methods further?
Cheers!
– Brook
February 10, 2016 at 1:53 pm #1071079Tommy
ParticipantBrook i really appreciate your help. But you need to be more clear. I want to understand you but i simply do not understand what you are asking of me. What exactly do you want me to do to fix this issue? Please tell me exactly “what” to put “where”
-
This reply was modified 10 years, 2 months ago by
Tommy.
February 11, 2016 at 2:16 am #1071211Brook
ParticipantHowdy Tommy,
I will certainly do my best. As our TOS says we are only to give an overview of advice, it is up to you (or someone you hire) to have the technical expertise with PHP to take the advice and run with it, including customizing code snippets to fit your needs. If you do not feel you have enough experience with PHP and WordPress, don’t forget about the man freelancers out there who can help you with your dev needs: List of freelance customizers.
I’m guessing you want to go with option 2, as it should be easier to follow. So let me expound a bit on that one. In order to add the title of the event to every ticket in the Woo order screens, including the “Customer completed order email”, do the following.
- Backup your site, just to be safe. Tutorial: Updating WordPress and Making Backups
- Paste this snippet at the top of your theme’s functions.php file. Replace the opening “<?php” with this snippet, as this snippet includes that opening tag.
- You need to modify that snippet some. Replace this line:
$title .= ' - '.$event_start_date;
with:
<span class="pl-smi">$title</span> <span class="pl-k">.=</span> <span class="pl-s"><span class="pl-pds">'</span> - <span class="pl-pds">'</span></span><span class="pl-k">.</span><span class="pl-smi">$event_title</span>; - Open up this file /plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php and scroll down to line 859. replace this:
if ( in_array( get_post_type( $event ), Tribe__Tickets__Main::instance()->post_types ) ) {
with this:
if ( in_array( get_post_type( $event ), Tribe__Tickets__Main::instance()->post_types() ) ) {
Is that helping you make sense of things? If not, you should definitely checkout the list of freelancers. Anyone of them should be able to tackle this with great ease. The actual dev work can easily be done within an hour assuming I’m clear on what you need.
Cheers!
– Brook
February 11, 2016 at 3:27 am #1071227Tommy
ParticipantOK i understand what your limitations are, but it seems if you just tell me what to put where, it will save so much time for you and for me…
OK so in the last reply, you wrote: “You need to modify that snippet some. Replace this line:”
What exactly are you talking about? Please be exact.. where do i have to go in order to find the file you want me to edit? The more exact you are, the better the chance i can follow your instructions because right there i don’t have a clue what you’re talking about.. you have told me what to do but you have not told me where to do it
February 11, 2016 at 3:30 am #1071228Tommy
ParticipantThis reply is private.
February 14, 2016 at 7:25 pm #1072928Brook
ParticipantThis reply is private.
February 29, 2016 at 8:35 am #1083411Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Need html code for purchased ticket info’ is closed to new replies.
