d_object_id ) { [ $token, $object_id ] = $this->session->get_session_token_object_id(); $cached_session_token = $token; $cached_object_id = $object_id; $cache['tec_tc_session_token_object_id_session_token'] = $cached_session_token; $cache['tec_tc_session_token_object_id_object_id'] = $cached_object_id; } return [ $cached_session_token, $cached_object_id ]; } /** * Saves the seat data for the attendee. * * @since 5.16.0 * * @param WP_Post $attendee The generated attendee. * @param Ticket_Object $ticket The ticket the attendee is generated for. */ public function save_seat_data_for_attendee( WP_Post $attendee, Ticket_Object $ticket ): void { [ $token, $object_id ] = $this->get_session_token_object_id(); $event_id = (int) $attendee->event_id; if ( $event_id && $event_id === (int) $object_id ) { $session_stack = $this->get_session_stack( (string) $token, (int) $object_id, (int) $ticket->ID ); $reservation_data = $session_stack->current(); $session_stack->next(); $reservation_id = $reservation_data['reservation_id'] ?? ''; update_post_meta( $attendee->ID, Meta::META_KEY_RESERVATION_ID, $reservation_id ); $seat_label = $reservation_data['seat_label'] ?? ''; update_post_meta( $attendee->ID, Meta::META_KEY_ATTENDEE_SEAT_LABEL, $seat_label ); $seat_type_id = $reservation_data['seat_type_id'] ?? ''; update_post_meta( $attendee->ID, Meta::META_KEY_SEAT_TYPE, $seat_type_id ); } $layout_id = $attendee->product_id ? get_post_meta( $attendee->product_id, Meta::META_KEY_LAYOUT_ID, true ) : false; // Add the layout ID to the attendee if it exists for the attendee product. if ( $layout_id ) { update_post_meta( $attendee->ID, Meta::META_KEY_LAYOUT_ID, $layout_id ); } } /** * Maybe clear the cart if the session is expired or the session is empty but cart has seated tickets. * * @since 5.16.0 * * @return void */ public function maybe_clear_cart_for_empty_session(): void { [ $token, $object_id ] = $this->get_session_token_object_id(); $cart = tribe( TicketsCommerce_Cart::class ); // Check if there are any seating sessions available. if ( ! empty( $token ) || ! empty( $object_id ) ) { /** * If we have a valid session, we should check if the token is expired or not. * This is to force clear cart for cases where AJAX request may have failed to delete an expired token. */ if ( $this->sessions->get_seconds_left( $token ) <= 0 ) { $cart->clear_cart(); } return; } // If the cart has any item with seating enabled then we need to clear the cart. foreach ( $cart->get_items_in_cart() as $ticket_id => $item ) { if ( get_post_meta( $ticket_id, META::META_KEY_ENABLED, true ) ) { $cart->clear_cart(); break; } } } } d_object_id ) { [ $token, $object_id ] = $this->session->get_session_token_object_id(); $cached_session_token = $token; $cached_object_id = $object_id; $cache['tec_tc_session_token_object_id_session_token'] = $cached_session_token; $cache['tec_tc_session_token_object_id_object_id'] = $cached_object_id; } return [ $cached_session_token, $cached_object_id ]; } /** * Saves the seat data for the attendee. * * @since 5.16.0 * * @param WP_Post $attendee The generated attendee. * @param Ticket_Object $ticket The ticket the attendee is generated for. */ public function save_seat_data_for_attendee( WP_Post $attendee, Ticket_Object $ticket ): void { [ $token, $object_id ] = $this->get_session_token_object_id(); $event_id = (int) $attendee->event_id; if ( $event_id && $event_id === (int) $object_id ) { $session_stack = $this->get_session_stack( (string) $token, (int) $object_id, (int) $ticket->ID ); $reservation_data = $session_stack->current(); $session_stack->next(); $reservation_id = $reservation_data['reservation_id'] ?? ''; update_post_meta( $attendee->ID, Meta::META_KEY_RESERVATION_ID, $reservation_id ); $seat_label = $reservation_data['seat_label'] ?? ''; update_post_meta( $attendee->ID, Meta::META_KEY_ATTENDEE_SEAT_LABEL, $seat_label ); $seat_type_id = $reservation_data['seat_type_id'] ?? ''; update_post_meta( $attendee->ID, Meta::META_KEY_SEAT_TYPE, $seat_type_id ); } $layout_id = $attendee->product_id ? get_post_meta( $attendee->product_id, Meta::META_KEY_LAYOUT_ID, true ) : false; // Add the layout ID to the attendee if it exists for the attendee product. if ( $layout_id ) { update_post_meta( $attendee->ID, Meta::META_KEY_LAYOUT_ID, $layout_id ); } } /** * Maybe clear the cart if the session is expired or the session is empty but cart has seated tickets. * * @since 5.16.0 * * @return void */ public function maybe_clear_cart_for_empty_session(): void { [ $token, $object_id ] = $this->get_session_token_object_id(); $cart = tribe( TicketsCommerce_Cart::class ); // Check if there are any seating sessions available. if ( ! empty( $token ) || ! empty( $object_id ) ) { /** * If we have a valid session, we should check if the token is expired or not. * This is to force clear cart for cases where AJAX request may have failed to delete an expired token. */ if ( $this->sessions->get_seconds_left( $token ) <= 0 ) { $cart->clear_cart(); } return; } // If the cart has any item with seating enabled then we need to clear the cart. foreach ( $cart->get_items_in_cart() as $ticket_id => $item ) { if ( get_post_meta( $ticket_id, META::META_KEY_ENABLED, true ) ) { $cart->clear_cart(); break; } } } }
Fatal error: Uncaught TEC\Common\Exceptions\Not_Bound_Exception: TEC\Tickets\Seating\Orders\Controller => Error while making TEC\Tickets\Seating\Orders\Cart $cart: parameter $cart is not optional and its type (TEC\Tickets\Seating\Orders\Cart) cannot be resolved to a concrete class. in /htdocs/wp-content/plugins/event-tickets/common/src/Common/Contracts/Container.php:27 Stack trace: #0 /htdocs/wp-content/plugins/event-tickets/common/vendor/vendor-prefixed/lucatume/di52/src/Container.php(460): TEC\Common\Contracts\Container->get('TEC\\Tickets\\Sea...') #1 /htdocs/wp-content/plugins/event-tickets/common/src/Common/Contracts/Container.php(46): TEC\Common\lucatume\DI52\Container->register('TEC\\Tickets\\Sea...') #2 /htdocs/wp-content/plugins/event-tickets/src/Tickets/Seating/Controller.php(124): TEC\Common\Contracts\Container->register('TEC\\Tickets\\Sea...') #3 /htdocs/wp-content/plugins/event-tickets/common/src/Common/Contracts/Provider/Controller.php(49): TEC\Tickets\Seating\Controller->do_register() #4 /htdocs/wp-content/plugins/event-tickets/common/vendor/vendor-prefixed/lucatume/di52/src/Container.php(462): TEC\Common\Contracts\Provider\Controller->register() #5 /htdocs/wp-content/plugins/event-tickets/common/src/Common/Contracts/Container.php(46): TEC\Common\lucatume\DI52\Container->register('TEC\\Tickets\\Sea...') #6 /htdocs/wp-content/plugins/event-tickets/src/Tickets/Provider.php(101): TEC\Common\Contracts\Container->register('TEC\\Tickets\\Sea...') #7 /htdocs/wp-content/plugins/event-tickets/common/vendor/vendor-prefixed/lucatume/di52/src/Container.php(462): TEC\Tickets\Provider->register() #8 /htdocs/wp-content/plugins/event-tickets/common/src/Common/Contracts/Container.php(46): TEC\Common\lucatume\DI52\Container->register('TEC\\Tickets\\Pro...') #9 /htdocs/wp-content/plugins/event-tickets/common/src/Tribe/Container.php(305): TEC\Common\Contracts\Container->register('TEC\\Tickets\\Pro...') #10 /htdocs/wp-content/plugins/event-tickets/src/Tribe/Main.php(458): tribe_register_provider('TEC\\Tickets\\Pro...') #11 /htdocs/wp-content/plugins/event-tickets/src/Tribe/Main.php(428): Tribe__Tickets__Main->bind_implementations() #12 /htdocs/wp-includes/class-wp-hook.php(324): Tribe__Tickets__Main->bootstrap('') #13 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #14 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #15 /htdocs/wp-content/plugins/event-tickets/common/src/Tribe/Main.php(128): do_action('tribe_common_lo...') #16 /htdocs/wp-includes/class-wp-hook.php(324): Tribe__Main->plugins_loaded('') #17 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #18 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #19 /htdocs/wp-settings.php(555): do_action('plugins_loaded') #20 /htdocs/wp-config.php(95): require_once('/htdocs/wp-sett...') #21 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #22 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #23 /htdocs/index.php(17): require('/htdocs/wp-blog...') #24 {main} thrown in /htdocs/wp-content/plugins/event-tickets/common/src/Common/Contracts/Container.php on line 27