Can't edit tickets — admin-ajax.php 500 (Internal Server Error)

Home Forums Ticket Products Event Tickets Plus Can't edit tickets — admin-ajax.php 500 (Internal Server Error)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1227742
    Kyle
    Participant

    Hi there

    I’m receiving a 500 error when trying to edit tickets in Event Tickets Plus. It’s very similar to a previous topic that has since been resolved, clicking Edit causes the ticket postbox to gray out for a few seconds, and then nothing else happens. Console indicates a 500 Internal Server Error on the call to admin-ajax.php.

    In my case it is affecting all tickets. Turning on WP_DEBUG produced the following log:

    Call to undefined function edd_get_download() in .../plugins/event-tickets-plus/src/Tribe/Commerce/EDD/Main.php:753

    Please advise if you require the stack trace.

    Thanks for your attention to this matter

    #1228595
    Hunter
    Moderator

    Hey Kyle,

    I’d be happy to help out, but before I’m able to do much I’ll need you to review our Testing for conflicts guide and let me know what you find out. In addition to having WP_DEBUG set to ‘true’, can you use the ‘Inspect‘ tool and let me know if any errors display in the console?

    Once I have that information, I’ll compare it to our bug reports and test to see if I can reproduce the behavior. Thanks and have a great rest of your day 🙂

    #1231000
    Kyle
    Participant

    I’ve investigated further and was able to resolve the issue. I’m going to describe how I solved it in case it might be helpful to others who stumble across this thread.

    I found out that it was due to a function that I had in my functions.php file to move the location of the ticket purchase form. Here is the function that caused the problem:

    
    /**
     * Tribe Event Tickets Plus
     * Move Ticket Form Below the Event Description
     * @see tribe_etp_move_tickets_purchase_form()
     */
    tribe_etp_move_tickets_purchase_form( 'tribe_events_single_event_after_the_content', 5 );
    
    /**
     * Moves the front-end ticket purchase form, accepts WP action/hook and optional hook priority
     * 
     * @param $ticket_location_action WP Action/hook to display the ticket form at
     * @param $ticket_location_priority Priority for the WP Action
     */
    function tribe_etp_move_tickets_purchase_form ( $ticket_location_action, $ticket_location_priority = 10 ) {
      $etp_classes = array(
        'Tribe__Tickets_Plus__Commerce__EDD__Main',
      //  'Tribe__Tickets_Plus__Commerce__Shopp__Main', // As of ETP v4.0 Shopp will generate errors when referenced, if not active. Uncomment this line if you have Shopp Active
        'Tribe__Tickets_Plus__Commerce__WPEC__Main',
        'Tribe__Tickets_Plus__Commerce__WooCommerce__Main'
      );
      foreach ( $etp_classes as $ticket_class ) {
        if ( ! class_exists( $ticket_class ) ) break;
        $form_display_function = array( $ticket_class::get_instance(), 'front_end_tickets_form' );
        if ( has_action ( 'tribe_events_single_event_after_the_meta', $form_display_function ) ) {
          remove_action( 'tribe_events_single_event_after_the_meta', $form_display_function, 5 );
          add_action( $ticket_location_action, $form_display_function, $ticket_location_priority );
        }
      }
    }
    

    I found another support topic complaining of the same error and they mentioned removing unnecessary items from the $etp_classes array solved the problem for them. My stack trace indicates the error stems from the following source:

    
    #0 /.../plugins/event-tickets-plus/src/Tribe/Commerce/EDD/Main.php(1068): Tribe__Tickets_Plus__Commerce__EDD__Main->get_ticket('1544', '5690')
    

    Since I’m using WooCommerce I’ve removed items not related to WooCommerce from the array and it solved the issue. The function now looks like so:

    
    /**
     * Tribe Event Tickets Plus
     * Move Ticket Form Below the Event Description
     * @see tribe_etp_move_tickets_purchase_form()
     */
    tribe_etp_move_tickets_purchase_form( 'tribe_events_single_event_after_the_content', 5 );
    
    /**
     * Moves the front-end ticket purchase form, accepts WP action/hook and optional hook priority
     * 
     * @param $ticket_location_action WP Action/hook to display the ticket form at
     * @param $ticket_location_priority Priority for the WP Action
     */
    function tribe_etp_move_tickets_purchase_form ( $ticket_location_action, $ticket_location_priority = 10 ) {
      $etp_classes = array(
        'Tribe__Tickets_Plus__Commerce__WooCommerce__Main'
      );
      foreach ( $etp_classes as $ticket_class ) {
        if ( ! class_exists( $ticket_class ) ) break;
        $form_display_function = array( $ticket_class::get_instance(), 'front_end_tickets_form' );
        if ( has_action ( 'tribe_events_single_event_after_the_meta', $form_display_function ) ) {
          remove_action( 'tribe_events_single_event_after_the_meta', $form_display_function, 5 );
          add_action( $ticket_location_action, $form_display_function, $ticket_location_priority );
        }
      }
    }
    

    I can’t remember if I got this function from your site or not, but if you recognize it and it is something that has been shared in your official documentation, please be advised that it is causing these issues.

    • This reply was modified 9 years, 2 months ago by Kyle.
    #1231072
    Hunter
    Moderator

    Thank you for letting me know you’ve got things figured out and also for sharing your solution for others to learn from. Feel free to create a new thread if you have any more questions or comments and have a pleasant evening. Cheers!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Can't edit tickets — admin-ajax.php 500 (Internal Server Error)’ is closed to new replies.