Support

Home Forums Event Espresso Premium Ticket Numbers – EE4

Ticket Numbers – EE4

Posted: January 28, 2015 at 2:10 pm

Viewing 8 reply threads


Guvnor

January 28, 2015 at 2:10 pm

Hi all,

I’ve read through a few posts about changing ticket numbers etc, but what I am after is this:

1 Event
Total tickets to be sold : 1000
Ticket Numbers 001-999 – Each ticket purchased must have a random number between 001 and 999 and each number cannot be duplicated once its sold.

Thanks


Lorenzo Orlando Caum

  • Support Staff

January 28, 2015 at 2:57 pm

Hi, are you referring to registration IDs that are assigned to a registrant?

Those are not whole numbers, rather they are a mix of alphanumerical characters.


Lorenzo


Guvnor

January 28, 2015 at 3:27 pm

I Understand, I need though ๐Ÿ™‚


Guvnor

January 28, 2015 at 4:28 pm

Sorry Lorenzo, I was typing using a dysfunctional cell phone with my last reply.

What I meant to say was, that yes I am referring to the ID’s assigned to the registrant (ticket number) and yes I understand that they are currently a mix of alphanumerical numbers, but my question is: How can that be changed to 4 digits, all numbers, as my original post depicts.

Thanks


Dean

January 29, 2015 at 5:32 am

Hi,

This can be done, but needs to be done via a PHP function.

There is a filter called FHEE__EE_Registration___generate_new_reg_code__new_reg_code which allows you to modify the reg code.

Now, I’ve created an example below. This is only an EXAMPLE and would no doubt require further coding work to make it completely suitable for your particular needs, but it should give you and your developer an idea of how to implement it.

For instance I have not based it on ticket sales, instead I have just used a basic counter via post meta, and also the post ID is hardcoded. So it will need further work, but should get you started.

function change_reg_code($new_reg_code, $this) {

  //get the custom meta field being used as a count
  $ticket_count = get_post_meta( 32, 'ticket_limit', true );

  //if it is empty, set the default to one
  if( !$ticket_count || $ticket_count == '') {
    $ticket_count = '1';
    update_post_meta(32, 'ticket_limit', $ticket_count);
  } else {
    $ticket_count++;
  }

  //add leading zeroes to make the code 4 in length.
  $new_reg_code = str_pad($ticket_count, 4, "0", STR_PAD_LEFT);

  //update the count used
  update_post_meta(32, 'ticket_limit', $ticket_count);

  //send the new reg code back to be used.
  return $new_reg_code;
}
add_filter('FHEE__EE_Registration___generate_new_reg_code__new_reg_code','change_reg_code', 10, 2);


Guvnor

January 29, 2015 at 5:56 am

Ok, Thanks Dean.

Can this request be added to the “Feature list for further development” please?

To me , this feature would allow more sales for EE as it can be used as a raffle ticket system based on drawn lottery numbers that only have 3-4 digits.

So that way, a 1000 tickets can be sold and whatever the lottery number drawing is, whoever holds that matching ticket number, wins the prize for that week.

Simple ๐Ÿ™‚

If you know someone who can fully develop this, I’d be very interested.


Dean

January 29, 2015 at 6:25 am

Hi,

I’ll certainly add it as a feature request.

Most competent PHP developers should be able to flesh it out, but we have a list of recommended EE developers here: https://eventespresso.com/developers/event-espresso-pros/


Guvnor

January 29, 2015 at 6:33 am

I’d be interested if someone could develop it as a plugin for EE, any takers? lol


Lorenzo Orlando Caum

  • Support Staff

January 29, 2015 at 10:42 am

Hi,

Please check with an Event Espresso professional here:

https://eventespresso.com/developers/event-espresso-pros/


Lorenzo

Viewing 8 reply threads

The support post ‘Ticket Numbers – EE4’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso