Home › Forums › Ticket Products › Event Tickets Plus › Offsetting ticket number
- This topic has 14 replies, 2 voices, and was last updated 8 years, 7 months ago by
Penny Scaffold.
-
AuthorPosts
-
September 5, 2017 at 1:54 am #1344753
Penny Scaffold
ParticipantHi,
I need to offset the ticket number on some raffle tickets we are selling as we are selling some offline (and they have already been printed/distributed). Is there a way to do this? So I start a ticket number 900001 instead of 1?
Alternatively, could I add leading zeroes, so I use the SKU as 900 and add in 001 etc. ? I’d prefer to start the ticket number higher if possible?
Happy with functions.php changes etc. if you could give me a snippet that might help?
Many thanks as always,
Penny
September 6, 2017 at 12:53 pm #1345640Andras
KeymasterHello Penny,
Great question there, thanks for reaching out!
Ticket numbers are automatically generated based on what ID they receive when added to the database. Every post, event, ticket, venue, custom post is added to the same database table and all of them receive a unique ID, which starts from 1 and increases by 1 with every new addition. This is a bit tricky to influence.
However, if you are using WooCommerce then order numbers can be set with this plugin:
or with it’s Pro version:
Would this work for you? Let me know.
Cheers,
AndrasSeptember 7, 2017 at 1:46 am #1345864Penny Scaffold
ParticipantHi, thanks so much for the tips but unfortunately that won’t work in this case. We are selling other products from the shop and it is the ticket number, not the order number, that I need to control as they could purchase multiple raffle tickets in one order.
I don’t suppose you have any other suggestions in how I can influence the ticket number? Ideally I need to start it at 9001. I tried buying 9000 raffle tickets to increase the ticket number, but despite saying 9000 tickets sold it only registered as ticket number 1200 when I next purchased a ticket. I could purchase bulk amounts for free, in 500 clumps, to get up to 9000 before I start selling, then delete the ones I don’t need, but this seems like a really bad way of doing it!
Any suggestions greatly appreciated.
Thanks,
Penny
September 7, 2017 at 3:10 am #1345872Penny Scaffold
ParticipantHi, unfortunately I’ve been informed that the ticket number needs to start after 400,000 so I was wondering if we could use the SKU as a number, e.g. 40, and add 3 trailing zeroes to the ticket email so ticket 1 would be 0001 and ticket 100 would be 0100, so ticket number would look like 40-0001 and ticket number 100 would look like 40-0100.
Would it be possible to add trailing zeroes to the ticket numbers in the emails the participants receive?
Many thanks for all your help.
Penny
September 7, 2017 at 8:56 am #1345999Penny Scaffold
ParticipantHi,
I have thought of a possible solution
– Create an editable field called “raffle ticket number” (This is separate to the automatically assigned ticket number)
– Hide this with CSS on the shop
– Delay the ticket being sent until the order has been “completed”
– Manually add in the raffle ticket number in the back end and then mark the order as “completed” therefore generating the tickets to the customerThe only bit I could then do with help on then is how to add that “raffle ticket number” field into the ticket email – could you assist?
Many thanks!
Penny
September 8, 2017 at 2:35 am #1346500Andras
KeymasterHi Penny,
Unfortunately we are limited in supporting customizations based on our support policy.
I’m happy to share with you a list of freelancers who could help you out with this. They are known in the community and are not affiliated with us in any way.
Here are some thoughts though that can help you get started:
Create an editable field called “raffle ticket number” (This is separate to the automatically assigned ticket number)
Unless you want this to be totally unique for every purchased ticket, you could use the SKU field for this.
In the email that goes out you can potentially combine the SKU field with the Ticket number.
The email you can customize with a template override. You can find detail on how to do this in our Themer’s Guide – https://theeventscalendar.com/knowledgebase/themers-guide/
You will need to create an override for this file:
wp-content\plugins\event-tickets\src\views\tickets\email.php
Delay the ticket being sent until the order has been “completed”
There is a setting for this under Events > Settings > Tickets tab which looks like this.
I hope this helps.
Cheers,
AndrasSeptember 8, 2017 at 2:36 am #1346501Andras
KeymasterI will still ask the team if anyone has an idea that could help. Will let you know.
A.
September 11, 2017 at 12:15 am #1347358Penny Scaffold
ParticipantHi Andras,
Thank you so much for all your help. Each ticket number has to be unique so I can’t use the SKU but have used a hidden field which is working well.
I’ve got it all working as I would like apart from the formatting and title of “tribe_tickets_ticket_email_ticket_bottom” in my email.php
This function is in event-tickets-plus > src > Tribe > Meta > Render.php
and calls ticket_email_meta
/**
* Inject custom meta in to tickets
* @param array $item Attendee data
*/
public function ticket_email_meta( $item )1. I wish to be able to override the title:
<?php esc_html_e( ‘Attendee Information’, ‘event-tickets-plus’ ); ?>To just say “Ticket information” Not “Attendee information”
2. I would also like to change the colour of the table from #f7f7f7 to the colour of the rest of the email that I’ve created (#F3F5F8) and add some additional padding at the bottom.
This isn’t in the list of templates in the themer’s guide so I’m not sure how to override these? I don’t want to edit the plugin files for obvious reasons.
Please can you advise?
Many thanks,
Penny
September 11, 2017 at 12:59 pm #1347678Andras
KeymasterHey Penny,
Awesome job, congratulations!
To change the Attendee Information check this article, at the end you will find a snippet that should help you change this.
If you would like to change the looks of the email, you can do that with a template override of this file:
wp-content\plugins\event-tickets\src\views\tickets\email.php
Let me know how these work out for you.
Cheers,
AndrasSeptember 11, 2017 at 1:36 pm #1347712Penny Scaffold
ParticipantHi Andras,
Thanks for the pointers, much appreciated, however:
<?php esc_html_e( ‘Attendee Information’, ‘event-tickets-plus’ ); ?>
In render.php (line 162) is not being overridden by:
$custom_text = array(
‘Attendee Information’ => ‘Ticket Information’,
);In the functions.php file. Should this override definitely work for the tickets email?
Also the formatting of the Attendee data isn’t in email.php but in render.php (line 159)
<table class=”inner-wrapper” border=”0″ cellpadding=”0″ cellspacing=”0″ width=”620″ bgcolor=”#f7f7f7″ style=”margin:0 auto !important; width:620px; padding:0;”>
It is just called by:
<?php do_action( ‘tribe_tickets_ticket_email_ticket_bottom’, $ticket ); ?>
In email.phpSorry but can you possibly check if there’s a way to do this not editing render.php?
Many thanks for your continued assistance,
Penny
September 12, 2017 at 6:20 am #1347956Andras
KeymasterHi Penny, did you copy the full code found here into your functions.php?
https://gist.github.com/theeventscalendar/734adb9e94f11b940e5f
I’m checking for the color change.
Andras
September 12, 2017 at 6:38 am #1347967Andras
KeymasterYou could try to change the color with this code:
class Not_The_Cleanest_Way_To_Customize { public function __construct() { add_action( 'tribe_tickets_ticket_email_ticket_bottom', array( $this, 'capture' ), 1 ); add_action( 'tribe_tickets_ticket_email_ticket_bottom', array( $this, 'output' ), 1000 ); } public function capture() { ob_start(); } public function output() { $html = ob_get_clean(); $old = '#f7f7f7'; $new = '#ff0000'; print str_replace ( $old, $new, $code ); } } new Not_The_Cleanest_Way_To_Customize;Or you can unhook and replace the function. Unhooking would be something like this:
$renderer = Tribe__Tickets_Plus__Meta::instance()->render(); $callback = array( $renderer, 'ticket_email_meta' ); remove_action( 'tribe_tickets_ticket_email_ticket_bottom', $callback );A.
September 12, 2017 at 6:45 am #1347974Penny Scaffold
ParticipantHi,
Thanks so much for all your help and assistance. I’ve redone the function and it is working now, sincere apologies it must have been my error. I’ll give your colour change suggestion a go but I’m super happy and will close the ticket now, as you’ve gone over and above to help me!
Many many thanks,
Penny
September 12, 2017 at 7:00 am #1347985Andras
KeymasterPenny, I’m stoked to hear that I could help you at least a bit.
I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic in the forum and we will be happy to help you out.
Good luck down the road!
Cheers,
AndrasPS: If you like our plugin, and you didn’t yet do so 🙂 we would be happy to receive a review in the wordpress.org repository. Thanks!
https://wordpress.org/support/view/plugin-reviews/the-events-calendar/
https://wordpress.org/support/view/plugin-reviews/event-tickets/PS2: We’d be also grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Doublethanks!
-
AuthorPosts
- The topic ‘Offsetting ticket number’ is closed to new replies.
