Okay
  Public Ticket #3684189
Export all ticket orders for a given event
Closed

Comments

  •  2
    rosewich started the conversation

    Is there a way to view or export all ticket orders for a given event / with given event-ID?


  •  2
    rosewich replied

    Any news on this?

    The “Ticket orders” view goes into a good direction, especially when using the “List by ticket” option in combination with search (by event title).

    However, if a given order contains tickets for two different events, the ticket for the non-matching event will also be listed. 

    -> We should really have an option to see all tickets for just one event.

  •  894
    Zhivko replied

    Sorry for the delayed response.

    Currently, you can export all orders or a selection using the checkboxes. We plan to redesign the orders section, and I'll ensure the feature you need is included.


    Stachethemes Developer

  •  2
    rosewich replied

    Our on-location event manager is getting really unhappy really fast about this issue. He should really be able to have a per-event ticket orders list. 

    The currently implemented “Export all orders” list puts every order into one row. So if any order contains tickets for several events, the list cannot even be filtered in Excel. 

    I'm not sure how long it will take for the new order management?

    In the meantime, could you provide an export of all tickets (not orders), so that we can filter them in the CSV? 


  •  894
    Zhivko replied

    I can provide you with temporary solution to this:

    Open file /includes/woocommerce/class.rest-orders-controller.php

    Find the function export_orders (line 224) and replace it with the one I've pasted below.

    public function export_orders($request) {
            $includes = $request->get_param('include');
            $wc_export = new WC_Export();
            if ($includes) {
                $ids_array = explode(',', $includes);
                $wc_export->set_by_ids($ids_array);
            }
            if (!$includes) {
                $args = array(
                    'return'           => 'ids',
                    'posts_per_page'   => -1,
                    'orderby'          => 'date',
                    'order'            => 'DESC',
                    'meta_key'         => 'stec_has_tickets',
                    'meta_value'       => '1',
                    'meta_compare'     => '='
                );
                if (!current_user_can('stec_edit_orders')) {
                    $args['customer_id'] = get_current_user_id();
                }
                $ids       = array();
                $order_ids = wc_get_orders($args);
                if (is_wp_error($order_ids)) {
                    $ids = array();
                }
                foreach($order_ids as $order_id) {
                    $order_tickets = Booking::get_tickets_from_order($order_id);
                    foreach ($order_tickets as $ticket) {
                        $ids[] = $order_id . '-' . $ticket->get_id();
                    }
                }
                $wc_export->set_by_ids($ids);
            }
            $wc_export->download_csv();
    }
    

    Stachethemes Developer