/** * Constructor */ public function __construct($ticket_id, $data = array()) { $this->ticket_id = $ticket_id; $this->post = tribe_events_get_ticket_event($this->ticket_id); $this->field_type_name = array('checkbox' => __('Checkbox', 'event-tickets-plus'), 'radio' => __('Radio', 'event-tickets-plus'), 'select' => __('Dropdown', 'event-tickets-plus'), 'text' => __('Text', 'event-tickets-plus')); $this->initialize_data($data); }
/** * Adjusts global stock levels for any of the products that were just purchased. * * Expects to fire during the 'event_tickets_edd_tickets_purchased_inventory_recorded' action. * * @param array $quantities */ public function adjust_stock_levels(array $quantities) { foreach ($quantities as $ticket_id => $amount_purchased) { $ticket_id = absint($ticket_id); $event = tribe_events_get_ticket_event($ticket_id); $global_stock = new Tribe__Tickets__Global_Stock($event->ID); // We're only interested if the ticket utilizes global stock if (!$global_stock->is_enabled()) { continue; } // Try to load the actual ticket object $tickets = $this->get_event_tickets($event->ID); // Move on if we couldn't obtain the ticket object if (empty($tickets[$ticket_id])) { continue; } switch ($tickets[$ticket_id]->global_stock_mode()) { // Reduce the cap in line with the number of capped tickets that were purchased, if any case Tribe__Tickets__Global_Stock::CAPPED_STOCK_MODE: $original_level = $tickets[$ticket_id]->global_stock_cap(); update_post_meta($ticket_id, '_global_stock_cap', $original_level - $amount_purchased); // Fall-through is deliberate - capped sales still draw from the global inventory pool // Fall-through is deliberate - capped sales still draw from the global inventory pool case Tribe__Tickets__Global_Stock::GLOBAL_STOCK_MODE: $original_level = $global_stock->get_stock_level(); $global_stock->set_stock_level($original_level - $amount_purchased); break; } } }
/** * Determines if the product object (or product ID) represents a ticket for * an event. * * @param $product * * @return bool */ function tribe_events_product_is_ticket($product) { $matching_event = tribe_events_get_ticket_event($product); return false !== $matching_event; }
?> </td> <td class="tickets_description" colspan="2"> <?php echo esc_html($ticket->description); ?> </td> </tr> <?php /** * Allows injection of HTML after an RSVP ticket table row * * @var Event ID * @var Tribe__Tickets__Ticket_Object */ do_action('event_tickets_rsvp_after_ticket_row', tribe_events_get_ticket_event($ticket->id), $ticket); } } //end foreach if ($is_there_any_product_to_sell) { ?> <tr class="tribe-tickets-meta-row"> <td colspan="4" class="tribe-tickets-attendees"> <header><?php esc_html_e('Send RSVP confirmation to:', 'event-tickets'); ?> </header> <?php /** * Allows injection of HTML before RSVP ticket confirmation fields *