Support

Home Forums Event Espresso Premium Displaying Available Tickets – Modifying Function and Shortcode Questions – EE4

Displaying Available Tickets – Modifying Function and Shortcode Questions – EE4

Posted: September 5, 2016 at 10:08 pm

Viewing 1 reply thread


Adam Bowie

September 5, 2016 at 10:08 pm

Hi, we just implemented the PHP described here by Dean:
https://eventespresso.com/topic/ee4-displaying-number-of-tickets-available/#post-104596

However, I am a little lost on the logic and also had a question:
1. How could that shortcode be changed to show the remaining available for a particular TICKET type for an event? e.g. If the event has 2 tickets, and we want to show the remaining available from each of the two ticket types

2. We are not understanding the logic flow. We have tested it on a page where we have 50 tickets available, with none purchased, and the output of the shortcode is “There are bucketloads of spaces left for Test-VIP” (where Test-VIP is our Event Name). How can the shortcode just display the “$remainderp” number?

Then we could just write “The are [show_capacity EVT_ID=83] tickets still available” in the WordPress WYSIWYG editor (or whatever shortcode we need).

Are there other useful threads you could direct me to, or perhaps just give a brief breakdown on the logic here?

Really useful, thank you…


Tony

  • Support Staff

September 6, 2016 at 4:43 am

Hi there,

1. How could that shortcode be changed to show the remaining available for a particular TICKET type for an event? e.g. If the event has 2 tickets, and we want to show the remaining available from each of the two ticket types

You would need a completely different function as the function Dean posts only pulls in the DTT_name, DTT_reg_limit, DTT_sold fields for the datetimes on the event.

It would likely be better to pull the information in using the EE4 Model System to get various bits of information as needed.

2. We are not understanding the logic flow. We have tested it on a page where we have 50 tickets available, with none purchased, and the output of the shortcode is “There are bucketloads of spaces left for Test-VIP” (where Test-VIP is our Event Name). How can the shortcode just display the “$remainderp” number?

The function currently takes the event ID and pulls the datetimes for that event, it then loops over those datetimes and build out a UL of datetimes, each with adding another LI to the list and outputting the details for each specific datetime.

To change that to just output the remaining spaces value you basically remove half the function but you would also need to use specific datetime ID’s rather than event ids (if you have more than one datetime EE will not know which datetime to output the details for and will just use the first it comes to for the event.

It sound more like you need your own custom functions to pull the details you want in.

Are there other useful threads you could direct me to, or perhaps just give a brief breakdown on the logic here?

I’ve added some comments to the function here:

https://gist.github.com/Pebblo/5ec81b6acc9fe06b8f8690b429b57d25

Viewing 1 reply thread

The support post ‘Displaying Available Tickets – Modifying Function and Shortcode Questions – 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