public function get_content_html() { $wootickets = Tribe__Events__Tickets__Woo__Main::get_instance(); $args = array('post_type' => $wootickets->attendee_object, 'meta_key' => $wootickets->atendee_order_key, 'meta_value' => $this->object->id, 'posts_per_page' => -1); $query = new WP_Query($args); $attendees = array(); foreach ($query->posts as $post) { $attendees[] = array('event_id' => get_post_meta($post->ID, $wootickets->atendee_event_key, true), 'ticket_name' => get_post(get_post_meta($post->ID, $wootickets->atendee_product_key, true))->post_title, 'holder_name' => get_post_meta($this->object->id, '_billing_first_name', true) . ' ' . get_post_meta($this->object->id, '_billing_last_name', true), 'order_id' => $this->object->id, 'ticket_id' => $post->ID, 'security_code' => get_post_meta($post->ID, $wootickets->security_code, true)); } return Tribe__Events__Tickets__Woo__Main::get_instance()->generate_tickets_email_content($attendees); }
/** * Load WooCommerce Tickets classes and verify if the min required conditions are met. * * If they are, it instantiates the Tribe__Events__Tickets__Woo__Main singleton. * If they are not, it uses the admin_notices hook with tribe_wootickets_show_fail_message * */ function wootickets_init() { tribe_init_woo_tickets_autoloading(); if (!wootickets_should_run() || !class_exists('Tribe__Events__Tickets__Tickets')) { $langpath = trailingslashit(basename(dirname(__FILE__))) . 'lang/'; load_plugin_textdomain('tribe-wootickets', false, $langpath); add_action('admin_notices', 'tribe_wootickets_show_fail_message'); return; } new Tribe__Events__Tickets__Woo__PUE(__FILE__); Tribe__Events__Tickets__Woo__Main::init(); }
public static function get_orders($event_id) { if (!$event_id) { return array(); } WC()->api->includes(); WC()->api->register_resources(new WC_API_Server('/')); $main = Tribe__Events__Tickets__Woo__Main::get_instance(); $tickets = $main->get_tickets($event_id); $args = array('post_type' => 'tribe_wooticket', 'post_status' => array('wc-pending', 'wc-processing', 'wc-on-hold', 'wc-completed', 'publish'), 'meta_query' => array(array('key' => '_tribe_wooticket_event', 'value' => $event_id))); $orders = array(); $query = new WP_Query($args); foreach ($query->posts as &$item) { $order_id = get_post_meta($item->ID, '_tribe_wooticket_order', true); if (isset($orders[$order_id])) { continue; } $order = WC()->api->WC_API_Orders->get_order($order_id); $orders[$order_id] = $order['order']; } return $orders; }
/** * Get (and instantiate, if necessary) the instance of the class * * @static * @return Tribe__Events__Tickets__Woo__Main */ public static function get_instance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }