Support

Home Forums Event Espresso Premium [EVENT_CUSTOM_VIEW] display number of tickets

[EVENT_CUSTOM_VIEW] display number of tickets

Posted: April 22, 2014 at 1:39 pm


Jerrad Gleim

April 22, 2014 at 1:39 pm

I have been able to modify my Espresso Custom Template’s php file and get it to look the way I want, but now I have had a request to add a column to the table displaying the number of tickets still available. I have tried tips in the forum and scoured through the php files in event espresso for clues and just when I think I have something that works, it doesn’t. I’m tired and getting nowhere fast.

I know that in the Custom Templates index.php file, on line 35 or so, I need to add another column to the table using <th class="th-group"><?php _e('Tickets Available','event_espresso'); ?></th> for example. And then on line 103 or so I need to add a section <td id="available_spaces-<?php echo $event_id ?>" class="spaces-available"> THE MAGIC CODE GOES HERE </td>.

I just need the “Magic Code.” Can anyone help me?

http://evscicats.com/erevolution/registration/

Thanks,

Jerrad


Tony

  • Support Staff

April 22, 2014 at 2:32 pm

Hi Jerrard,

We have the [ATTENDEE_NUMBERS] shortcode which can be used to display this. Take a look here for more info:

https://eventespresso.com/wiki/shortcodes-template-variables/#attendee-numbers

The “Magic code” you need would be:

<?php echo do_shortcode('[ATTENDEE_NUMBERS event_id="'.$event_id.'" type="available_spaces"]');?>

Does that help?


Jerrad Gleim

April 22, 2014 at 8:09 pm

Thanks for getting back to me so quick. Just tested the code and all my tickets show zero. In my settings, “Use registration limits on time slots?” is YES and group registrations is “OFF” for all events. Is there another setting I need to change to get this to work?

BTW – The code is not currently running on the page since registration is live. Don’t want our visitors to think we have no tickets left to sell!

Thanks!


Dean

April 23, 2014 at 2:29 am

Hi,

In the templates the $event_id isn’t there, so you will need to change it to

<?php echo do_shortcode('[ATTENDEE_NUMBERS event_id="'.$this_event_id.'" type="available_spaces"]');?>


Jerrad Gleim

April 23, 2014 at 7:02 am

I’m still getting zero for my tickets with the above code. Here it is on my test site at http://evscicats.com/n3wn355/events/.


Tony

  • Support Staff

April 23, 2014 at 10:05 am

Hi Jerrad,

Apologies, I tested on the latest development version which has a couple of changes that allowed the initial code to work.

For the Event ID use $event->id

<?php echo do_shortcode('[ATTENDEE_NUMBERS event_id="'.$event->id.'" type="available_spaces"]');?>

That should then display the correct numbers as currently $event_id & $this_event_id do not exist.

If you still run into issues can you upload the full code ussed for the template using a service such a pastebin and link it here please.


Jerrad Gleim

April 23, 2014 at 10:21 am

Tony,

That fixed it! Thanks so much.

Jerrad

The support post ‘[EVENT_CUSTOM_VIEW] display number of tickets’ 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