Support

Home Forums Event Espresso Premium Sold Out Events are not Sold Out

Sold Out Events are not Sold Out

Posted: November 4, 2017 at 2:04 am

Viewing 5 reply threads


AlphaStar

November 4, 2017 at 2:04 am

Hello,

It was working perfectly fine 2-3 months ago but now the sold out events with multiple tickets have their statuses ‘Published’. This is very inconvenient for us since the waitlist form is not loaded in these cases. I am guessing the system does not care the limit for the event if the ticket Qty total exceed this limit. I am attaching the screenshots of one of the events.

Limits and Tickets

Event Status

Frontend

The frontend link for the event is https://alphastar.academy/events/amca-17f-3/.

Please help, thanks…


AlphaStar

November 4, 2017 at 2:05 am

The message did not show the images. I am pasting the links:

https://imagebin.ca/v/3g6vWWfJpvGx

https://imagebin.ca/v/3g6wEEia9V03

https://imagebin.ca/v/3g6wRLjYqK2C


Josh

  • Support Staff

November 6, 2017 at 2:27 pm

Hi there,

Actually what’s happening with that particular event is its Datetime is “Active”, meaning the event is in progress (it’s currently between the datetime’s start date and end date).

May I ask does your code that checks whether the event is sold out or not check only on the post_status or does it also check the number of tickets sold vs available tickets?


AlphaStar

November 6, 2017 at 4:06 pm

Hi Josh,

The code was courteously provided by you.

/*
 * Display a contact form when the event is sold out to be used as a waiting list
 */
function ee_espresso_clean_event_status( $event ) {
    $status = $event instanceof EE_Event ? $event->get_active_status() : 'inactive';
    return $status;
}
 
function ee_special_sold_out_message( $post ) {
  $EVT_ID = $post->ID;
  $event = EEH_Event_View::get_event( $EVT_ID );
  if ( $event instanceof EE_Event ) {
    //Check if the event is sold out.
    if ( ee_espresso_clean_event_status( $event ) == 'DTS' || $event->display_ticket_selector() == 0 ) {
    //Set the ID of the Ninja Form you wish to call here.
    $ninja_forms_id = 2;
        if( method_exists( 'Ninja_Forms', 'display') ) {
            //Using Ninja Forms v3+
            Ninja_Forms()->display( $ninja_forms_id );
        } elseif( function_exists( 'ninja_forms_display_form' ) ) { 
            //Using a previous version of Ninja Forms
            ninja_forms_display_form( $ninja_forms_id ); 
        }    
    }
  }
}
add_action( 'AHEE_event_details_after_venue_details', 'ee_special_sold_out_message', 10 );

Thanks.


Josh

  • Support Staff

November 7, 2017 at 3:31 pm

Yeah that code will not work in every case, like when the event is active.

You can do something like this instead:

function ee_special_sold_out_message( $post ) {
  $event = $post->EE_Event;
  if ( $event instanceof EE_Event ) {
    $spaces_remaining = $post->EE_Event->total_available_spaces();
    $tickets_sold = $post->EE_Event->get_number_of_tickets_sold();
    //Check if the event is sold out.
    if ($tickets_sold >= $spaces_remaining ) {
    //Set the ID of the Ninja Form you wish to call here.
    $ninja_forms_id = 2;
        if( method_exists( 'Ninja_Forms', 'display') ) {
            //Using Ninja Forms v3+
            Ninja_Forms()->display( $ninja_forms_id );
        }  
    }
  }
}
add_action( 'AHEE_event_details_after_venue_details',
 'ee_special_sold_out_message', 10 );


AlphaStar

November 8, 2017 at 1:35 am

Got it, thanks…

Viewing 5 reply threads

The support post ‘Sold Out Events are not Sold Out’ 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