Home › Forums › Ticket Products › Event Tickets Plus › 5K EVENT – TICKET NUMBER PREFIX AND NUMBER
- This topic has 5 replies, 2 voices, and was last updated 8 years, 11 months ago by
Alfonso.
-
AuthorPosts
-
April 30, 2017 at 2:24 pm #1276548
Alfonso
ParticipantI am working on a 5k event.
During testing, I noticed that the tickets are generated with a prefix and a “-” and then the ticket number.
Example: VCPTV5-7, VCPTV5-8, VCPTV5-9…and so on.As part of the 5k Planning, I would like to assign runners a number upon purchasing their ticket.
Question:
1. Can I control the Prefix so that instead of displaying “VCPTV5” I can make it “RUNNER”
2. Can I set the initial number something arbitrary, let’s say RUNNER-100 so that the next tickets are 101, 102, and so on?If you have the function snippet to make this work, please forward.
May 1, 2017 at 10:53 am #1276844Cliff
MemberHi, Alfonso.
I’ll answer these in backwards order:
2)
We just recently added a hook making it possible to override the initial ticket number so it doesn’t have to start at 1.
Please reference this code snippet:
https://gist.github.com/cliffordp/91223c67e30e648257e47e50349d81f4
It is required to be a positive integer.
The applicable code is viewable at /wp-content/plugins/event-tickets-plus/src/Tribe/Meta/Unique_ID.php
1)
The part of that code that gets (or generates if not yet set) the prefix is the get_event_root() method in that file. The actual generation (if does not yet exist) happens in /wp-content/plugins/the-events-calendar/common/src/Tribe/Utils/Post_Root_Pool.php
Long story short, it needs to be unique and therefore it’s generated accordingly instead of being something like “RUNNER”… because then your next event you could not use “RUNNER” again.
Please let me know if you have any follow-up questions on this topic.
May 1, 2017 at 8:40 pm #1277050Alfonso
ParticipantThank you!
You state for 1)
/wp-content/plugins/the-events-calendar/common/src/Tribe/Utils/Post_Root_Pool.phpare you sure it is /the-events-calendar/
I don’t have that plugin installed. I found the same file in the /event-tickets/ folder.
I have /event-tickets/ and /event-tickets-plus/ directories.
Please confirm.
May 2, 2017 at 10:23 am #1277520Cliff
MemberAh, yes, in that case, the file would be at /wp-content/plugins/event-tickets/common/src/Tribe/Utils/Post_Root_Pool.php
The “common” directory is code that is loaded whether you have The Events Calendar, Event Tickets, or both — to try to keep things DRY.
Of course, it’s not recommended to modify core plugin files so the location of this file is likely moot if following best practices.
I did log an internal feature request to allow customizing it to something like “RUNNER” with the idea that if “RUNNER” already exists, it’d instead generate something like “RUNNER1” instead.
Please let me know if you have any follow-up questions on this topic.
May 24, 2017 at 9:35 am #1288367Support 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 ‘5K EVENT – TICKET NUMBER PREFIX AND NUMBER’ is closed to new replies.
