Custom "add columns" function for CSV export is preventing export

Home Forums Ticket Products Event Tickets Plus Custom "add columns" function for CSV export is preventing export

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1463538
    Penny Scaffold
    Participant

    Hi,

    We were provided with a function by yourselves which is posted below, so that we can join WooCommerce information to the export, essential for our CSV export as we then upload this information to our database.

    However this has been getting slower and slower and then failed to export last week. We were able to isolate it as the below function, as on removing the function it exported without error. I reduced the number of columns to just first name, last name and postcode, and it did finally export.

    This morning, with more ticket sales over the weekend, it is now failing to export again.

    Can you please advise on how I can at least limit the number of rows per export, is there any way I can do this in chunks?

    With the ongoing known issue of not exporting the ticketing information correctly, this is a real problem and now I have been asked to look at alternatives to Event Tickets Plus. We have also experienced very slow page load times (admin and front end) which has been isolated to events with additional fields (which is not theme related).

    I urgently need to resolve this export issue at the very least as we have ticket data we cannot import into our database.

    Your assistance is greatly appreciated.

    Many thanks,

    Penny

    /———————————————————————————–/
    /* TRIBE
    /———————————————————————————–/

    function tribe_export_custom_set_up ( $event_id ) {
    //Add Handler for Community Tickets to Prevent Notices in Exports

    if ( ! is_admin() ) {
    $screen_base = ‘tribe_events_page_tickets-attendees’;

    } else {
    $screen = get_current_screen();
    $screen_base = $screen->base;
    }

    $filter_name = “manage_{$screen_base}_columns”;

    add_filter( $filter_name, ‘tribe_export_custom_add_columns’, 100 );
    add_filter( ‘tribe_events_tickets_attendees_table_column’, ‘tribe_export_custom_populate_columns’, 10, 3 );
    }
    add_action( ‘tribe_events_tickets_generate_filtered_attendees_list’, ‘tribe_export_custom_set_up’ );

    function tribe_export_custom_add_columns ( $columns ) {
    $columns[‘wc_first_name’] = ‘First Name’;
    $columns[‘wc_last_name’] = ‘Last Name’;
    $columns[‘wc_address_1’] = ‘Address line 1’;
    $columns[‘wc_address_2’] = ‘Address line 2’;
    $columns[‘wc_address_city’] = ‘Address city’;
    $columns[‘wc_address_state’] = ‘Address state’;
    $columns[‘wc_address_postcode’] = ‘Address postcode’;
    $columns[‘wc_payment’] = ‘Payment’;
    $columns[‘wc_date’] = ‘Date’;
    return $columns;
    }

    function tribe_export_custom_populate_columns ( $value, $item, $column ) {

    $order = new WC_Order( $item[‘order_id’] );

    $firstname = utf8_decode($order->get_billing_first_name());
    $lastname = utf8_decode($order->get_billing_last_name());
    $address1 = utf8_decode($order->get_billing_address_1());
    $address2 = utf8_decode($order->get_billing_address_2());
    $addresscity = utf8_decode($order->get_billing_city());
    $addressstate = utf8_decode($order->get_billing_state());
    $addresspostcode = utf8_decode($order->get_billing_postcode());
    $payment = utf8_decode($order->get_payment_method());
    $datecreated = utf8_decode($order->get_date_created());

    if ( isset($order) ) {

    switch ($column) {    
    case 'wc_first_name':
            $value = $firstname;
        break;
    case 'wc_last_name':
            $value = $lastname;
        break;
    case 'wc_address_1':
            $value = $address1;
        break;
    case 'wc_address_2':
            $value = $address2;
        break;
    case 'wc_address_city':
            $value = $addresscity;
        break;
     case 'wc_address_state':
            $value = $addressstate;
        break;    
     case 'wc_address_postcode':
            $value = $addresspostcode;
        break;
    case 'wc_payment':
            $value = $payment;
        break;
    case 'wc_date':
            $value = $datecreated;
        break;
    

    }
    } else {
    $value = ‘-‘;
    }
    return $value;
    }

    #1465049
    Sky
    Keymaster

    Hi Penny,

    I’m sorry to hear that you are having issues with this. I will try to help you get it sorted out.

    Can you tell me how you are exporting the CSV file? Also, do you have a link to the custom code you were provided?

    Thanks,
    Sky

    #1465573
    Penny Scaffold
    Participant

    Hi,

    My sincere apologies, it looks as though I got that specific function from https://stackoverflow.com/questions/45811098/woocommerce-order-and-woocommerce-custom-fields-plugin-plus-events-tickets-plus

    I required this because there was not enough information to identify primary attendees without the WC information.

    I am exporting the data from the Export button on the Attendees page. Is there another way I can do this to limit numbers per export so it doesn’t keep hanging?

    Many thanks for your help,

    Penny

    #1466201
    Sky
    Keymaster

    Penny,

    Thank you for the additional details. There is not an easy way to break the attendees export into chunks. I think investigating the reason for the export slowing down and failing may be the way to go here.

    I am limited in the amount of support I can provide for customizations, but I will try to help if I can.

    Can you enable WP_DEBUG and WP_DEBUG_LOG as is described here. Once enabled, navigate to the attendees page on one of the events you are having issues with, and attempt an export.

    If there are any errors being generated, a file named “debug.log” should be created in your wp-content folder. Can you please upload the contents of this file here? If it is lengthy, please upload as a plain text file.

    Thanks,
    Sky

    #1486036
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Custom "add columns" function for CSV export is preventing export’ is closed to new replies.