Posted: March 29, 2017 at 4:36 am
Hi, I guess this is three questions! For Event Admin – 1. Is there a way in the back-end for Event Admins to see a list of events that shows how many places are left for each date/time instance? 2. If not, is it possible to do something on the front-end to show this, so Admin can go to one page that shows all future events with places remaining? (I did try putting the [ESPRESSO_EVENT_ATTENDEES] shortcode on a new page to see what that would show, but it doesn’t show anything – even though we have lots of upcoming events.) For end users – 3. Is there any code I can add which will show on every event page, how many places are remaining for each date/time instance (not tickets left) Can you help please? |
|
Hi, re point 3 – I\d ideally like to show this information before the ticket selector display but after the main event content. Thanks! |
|
Hi, again regarding point 3 – I also tried out the code below which I found (supposed to be used as a shortcode – but added it to functions.php) // print the remaining tickets left for each datetime function my_print_tickets_left_after_selector($atts) { $EVT_ID = get_the_ID(); //display a title $sql = “SELECT * “; $datetimes = $wpdb->get_results( $wpdb->prepare( $sql, $EVT_ID )); $dt_frmt = get_option(‘date_format’); //echo “ " . print_r($datetimes,1) . " “; foreach($datetimes as $datetime){ //if datetime name shown, display $name = !empty($datetime->DTT_name) ? ($datetime->DTT_name) . ‘: ‘ : date($dt_frmt, strtotime($datetime->DTT_EVT_start) ) . ‘: ‘; $x .= $name; $limit = $datetime->DTT_reg_limit; “; return $x; } Nothing is output at all. I also have the wait-list workaround using that same add_action statement… add_action( ‘AHEE__ticket_selector_chart__template__after_ticket_selector’, ‘ee_special_sold_out_message’, 10, 2 ); Thanks |
|
Hi there,
Wouldn’t they just look within the event and view the datetimes?
We don’t have anything that will output this currently but yes its possible with custom development.
ESPRESSO_EVENT_ATTENDEES outputs the attendee details for an event, not spaces available etc. If you add it to a random page it will try to use the next upcoming event but if it can’t find the event, it will output nothing.
There’s a few issues with the code you’ve posted, as you’ve changed how the code will be used from a shortcode into an action yet the code returns the value as expected to be used in a shortcode which as you’ve found outputs nothing to the page. Have you confirmed that the shortcode version outputs the details you need when you use the shortcode? |
|
Is that working as expected? |
|
Hi Tony, thanks for the reply. 1. but they’d have to do that for each event; hence my question! 🙂 To save them time, they’d ideally just run down a view & quickly check. 2. Ah ok. Any pointers on how we might achieve this? 3. I’ve not used the shortcode as I presume I’d need to change a template to do that? We’ve not touched single events at all and don’t really want to get into changing templates this late into development. Can you give any hints as to what I’d need to change to get it working as an action please? Yes, the wait-list workaround works a treat! 🙂 Thanks. |
|
It really wasn’t clear on what your looking for, hence my answer (which was really a question again) 🙂 Currently we don’t have an option for that, its possible to include but would require some custom development.
I can give you an overview of how I would do this. You can use this as a base: https://gist.github.com/joshfeck/6e33532c37a123bbf532 Pull the events that are upcoming or active (possibly exclude sold out events?) Loop through each event and pull the datetimes, then on each datetime use something like:
Which returns the spaces available based on {datetime limit} – {sold and reserved tickets} Or
Which returns the number of spaces available on the datetime taking into consideration all tickets available on the datetime.
To confirm if the shortcode version actually output what your expecting? No you’d just use the shortcode on a page and pass the event id to the shortcode.
You don’t However take a look at the hook you are using, you’ll find it’s passed the
That means you can use our models and avoid most of the hoop jumping the above code is doing, for example: https://gist.github.com/Pebblo/3d019689d6c51a302eb95bbd3174b91e The above is more of a base that you’ll want to modify to suit your needs. If you haven’t already I’d recommend taking a look at how out models system works here: https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System That help? |
|
Thanks Tony, I appreciate your help. |
|
Hi again, is there a doc that will show me what ‘hook’ (I think it’s called) I can use to position the places remaining action just before the ticket selector and after the main event content? Thanks |
|
Have you altered the default order of the event details? The ticket selector would normally show before the event details, so are you wanting to include the remaining spaces twice? Or have you moved the ticket selector after the content and now want it displayed above that? There’s a lot of different options within EE which can effect the output and how you add additional details, so the more details you provide the better we can help. There is another hook fired just before the ticket selector:
Note that only passes the $event, so the example code I provided needs to be changed as its expecting |
|
Thanks Tony. The order of elements displayed for a single event has been changed using Events > Templates > custom display order, as follows – Event Description So what would I use to place this info above ticket selector based on our custom order? I’ll try the one you provided, do I just change $EVT_ID to $event in the code? I’ve done some testing with the base code you kindly provided and have noticed three things… 1. The first date/time availability shown always has places available – 2 for some reason. e.g. 10 places available, 8 shown. 2. Date/times in the past are still shown, even if tickets are no longer on sale. (none sold) 3. The sequence of date/times shown doesn’t take year into account; e.g. 17-18 March 2018 is shown before 18-19 March 2017. I’d really appreciate your thoughts on these 3 points? Thank you. |
|
You can use the hook I mentioned above.
No there’s a few changes needed, the function should only be passed $event, and the hook needs the
That isn’t happening for me – http://take.ms/roV5e Maybe you have Reserved spaced on the datetime from testing tickets?
The current code just pulls all the datetimes for an event. You could use
The method used does not do any ordering at all, it just pulls the datetimes from the event. The above could also be used to prevent that, I’ve update my gist to include another example which dipslays the same details using the other hook. |
|
Thanks for that Tony. Will re-test as I’m sure that point 1 wasn’t down to any reserved tickets..! |
|
The support post ‘Show all events with places remaining’ 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.