Home › Forums › Ticket Products › Event Tickets Plus › Add ticket date to email & order info
- This topic has 5 replies, 3 voices, and was last updated 10 years, 6 months ago by
Support Droid.
-
AuthorPosts
-
October 12, 2015 at 12:07 am #1013571
Matt
ParticipantI have added the ticket date to the cart info (using your code at: https://theeventscalendar.com/knowledgebase/show-the-event-title-in-the-cart-next-to-the-ticket/ ) but I also need it on:
– order confirmation
– email confirmation
– order summary in woocommerce order adminDo you think it’s best to add the event date to each ticket name? OR do you have some code that can achieve this?
thanks
MattOctober 12, 2015 at 7:17 am #1013671Brian
MemberHi Matt,
Thanks for using our plugins. I can try to help out here.
It maybe possible to add the ticket date to those areas, but that is all in WooCommerce and I do not have any information on customizing their product.
It maybe easier to just add it to the title.
Or you could search for customization in WooCommerce to try and add it to these places.
We are limited in helping that, but could try to answer a question or two.
Let me know.
Thanks
October 21, 2015 at 4:38 am #1016484Matt
ParticipantI have found the code to insert information into the cart (see below) but all I need is the SQL query or PHP code to pull the date for an event from the database?
Can you point me in the right direction? (eG: tablename, fieldname etc..)?
thanks
Matt.
/*
* The Events Calendar – WooCommerce Tickets – Add Event Title to Product Title
* add coding to theme’s functions.php
* @version 3.12
*/
add_filter( ‘woocommerce_product_title’, ‘tribe_add_event_title_to_tickets_title’, 10 , 2 );
function tribe_add_event_title_to_tickets_title( $title, $product ) {
$product_id = $product->id;$event_id = get_post_meta($product_id , ‘_tribe_wooticket_for_event’, true );
$event_date = “”; // GET THE DATE FROM THE DB
$event_title = ”;
if ( $event_id ) {
$event_title = ‘ – ‘ . get_the_title( $event_title ) . ‘(‘.$event_date.’)’;
}return $title . $event_title;
}
October 21, 2015 at 5:32 am #1016488Matt
ParticipantI have now fixed this: using a combination of your snippet and a function called tribe_get_start_date($event_id,true,””,null);
here is my code which I included into functions.php
but now I need to edit the final email template which sends out the tickets?
Any ideas?
add_filter( ‘woocommerce_cart_item_name’, ‘woocommerce_cart_item_name_event_title’, 10, 3 );
function woocommerce_cart_item_name_event_title( $title, $values, $cart_item_key ) {
$ticket_meta = get_post_meta( $values[‘product_id’] );
$event_id = absint( $ticket_meta[‘_tribe_wooticket_for_event’][0] );
$event_date = tribe_get_start_date($event_id,true,””,null);
//var_dump($ticket_meta);if ( $event_id ) {
$title = sprintf( ‘%s for %s (‘.$event_date.’)’, $title, get_permalink( $event_id ), $event_title);
}
return $title;
}October 21, 2015 at 7:31 am #1016561Brian
MemberHi,
Glad you are getting closer.
The ticket email template is located here:
plugins/wootickets/src/views/wootickets/tickets.php
And you can move it to your theme and edit it there following our themer’s guide:
https://theeventscalendar.com/knowledgebase/themers-guide/
Is that what you are looking for?
November 5, 2015 at 6:05 am #1022113Support 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 ‘Add ticket date to email & order info’ is closed to new replies.
