Support

Home Forums Multiple Event Registration Add-on show remaining tickets per ticket type

show remaining tickets per ticket type

Posted: August 6, 2020 at 7:36 am

Viewing 10 reply threads


wayne

August 6, 2020 at 7:36 am

Hi I have looked through the forum and cant see to find a solution that works.
I would like to show the remaining tickets for each ticket type per event. Currently, each ticket reflects a one hour time slot. see
Each ticket has a limit of 35 as this is maximum capacity in todays COVID19 world. I have added
add_filter(
'FHEE__espresso_list_of_event_dates__datetime_html',
'my_add_total_spaces_display',
10,
2
);
function my_add_total_spaces_display( $html, $datetime ) {
$html .= '<br><span class="space-remain">Total spaces remaining: ';
$html .= $datetime->total_tickets_available_at_this_datetime();
$html .= '</span>';
return $html;
}

But can’t see anything I read about getting each ticket by name but this seems excessive work and am not sure this relates to my needs.

Thanks


Tony

  • Support Staff

August 7, 2020 at 7:26 am

Hi there,

The function you’ve added was created to displays all of the spaces available for a datetime but your title (and post) refers to tickets, so first lets clarify where that function outputs.

It’s display ‘Total Spaces Remaining: XXX’ after each datetime date on the event, here:

https://monosnap.com/file/U52m5Mgoyto26l5Hj8pZnPA7LsVoY2

Where are you looking to output the remaining spaces for tickets?


wayne

August 7, 2020 at 9:18 am

Yes – sorry its not the function I needed. I am looking to show available tickets per ticket type ie. sold 6 of 35 for each hourly slot.Im happy to update the template but wanted some direction in how to show them, i can’t see any filters or hooks?


Tony

  • Support Staff

August 7, 2020 at 10:16 am

Where are you looking to output the remaining spaces for tickets?

I need to know where you are wanting to output the details to know if there is a template or hook you can use.


wayne

August 7, 2020 at 11:21 am

Hi Tony
I am using Multi Event Registration Add-on using single_espresso_events template no customisation just injected into the_content(). You can see output a table of tickets types here http://kickabout.adigitalengagement.co.uk/sessions/technical-centre-free-play-7/
I was going to add a column or happy to add it anywhere if an easy fix. I can see each row has a ticket class and id so could use some ajax – can the ticket type be queried for numbers?

Thanks
w


Tony

  • Support Staff

August 10, 2020 at 8:55 am

Oh, I see. So you’re looking to include the remaining tickets within the ticket selector itself and that’s not easily done as the template isn’t filtered (intentionally as the ticket selectors has a lot of logic that could be easily broken).

The closest we have currently is this:

https://gist.github.com/joshfeck/0e2e59c39a36b76cc65a3b92f9543c79

Which requires the ‘Show Ticket Details?’ option to be set to Yes in Event Espresso -> Events -> Templates -> Ticket Selector Template Settings as it just uses jQuery to move the details from there into the main row.

I can see each row has a ticket class and id so could use some ajax – can the ticket type be queried for numbers?

Sure, if you have the ticket ID you can create an EE_Ticket object using our Model System and then get pretty much anything related to the ticket from that:

$ticket = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
if($ticket instanceof EE_Ticket) {
    echo $ticket->remaining();
}


wayne

August 13, 2020 at 9:01 am

Great thanks Tony
Just out of curiosity – if the buying limit is 10 tickets max and there are are only 5 remaining tickets for a specific time. Will the dropdown number selector only show the maximum available ticket?

W


Tony

  • Support Staff

August 13, 2020 at 9:13 am

Yes, the dropdown is the number of available tickets at that time.


wayne

August 17, 2020 at 9:12 am

Hi Tony, thanks for your support so far. Im not sure what’s going on but the details are not loading in per ticket in the single page so js can not get the relevant details. I am using a custom single event template, however i am using your filter to pull in the normal ee4 structure.
add_filter( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', '__return_true' );
you can see the page here http://kickabout.adigitalengagement.co.uk/sessions/technical-centre-free-play-4/
I don’t really want to mess with the TicketSelectorRowStandard class but shouldn’t

$ticket_selector_row_html .= $this->ticket_details->display(
$this->ticket_price,
$remaining,
$this->cols
);

show the remaining tickets or is it the global tickets for the event?


wayne

August 17, 2020 at 9:26 am

sorry to add to this it seems manually putting $ticket_selector_row_html .= “Only “.$remaining; does show the remaining tickets but not sure why the details are not.


Tony

  • Support Staff

August 17, 2020 at 1:17 pm

Im not sure what’s going on but the details are not loading in per ticket in the single page so js can not get the relevant details.

Have you set them to display in the ticket selector options?

Event Espresso -> Events -> Templates (tab) -> Ticket Selector Template Settings

show the remaining tickets or is it the global tickets for the event?

Sorry, I’m not sure I follow, show the remaining tickets where?

That function is outputting the additional ticket details and is passed the remaining tickets into the method, it outputs the whole section rather than just the remaining tickets value.

sorry to add to this it seems manually putting $ticket_selector_row_html .= “Only “.$remaining; does show the remaining tickets but not sure why the details are not.

Yeah, that’s appending the $remaining value onto the end of whatever is output on the row.

Do you have any functions hooking into:

FHEE__ticket_selector_chart_template__do_ticket_inside_row

or

FHEE__ticket_selector_chart_template__do_ticket_entire_row

Viewing 10 reply threads

The support post ‘show remaining tickets per ticket type’ 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