Woocommerce address field in CSV

Home Forums Ticket Products Event Tickets Plus Woocommerce address field in CSV

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

    Hi,

    I’ve been trying to implement the CSV example listed here:
    https://theeventscalendar.com/support/forums/topic/woocommerce-info-in-csv-export/#post-1234702

    However I am continually getting errors with the first function:
    Parse error: syntax error, unexpected ‘add_filter’ (T_STRING)

    for add_filter( $filter_name, ‘tribe_export_custom_add_columns’, 100 );

    Function below:
    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’ );

    I’ve tried:
    – Adding the function to a completely different theme
    – Editing the function to remove anything that might be offending

    But I still cannot get it to work and just get the error message with a white screen.

    Can you advise as to where I might be going wrong – I’m copying it directly, the thread is recent and others don’t seem to have had an issue with it?

    Many thanks,

    Penny

    #1320541
    Andras
    Keymaster

    Hello again Penny,

    Sorry you are having this issue.

    I see you only pasted part of the code in here. Did you paste all of this into your functions.php?

    As an alternative you can give this extension a try to see if that exports the phone number to the csv file, and based on that you can adjust it to export the fields you need.

    Does this help?

    Andras

    #1321140
    Penny Scaffold
    Participant

    Hi,

    I’m afraid this still isn’t working. I’ve actioned the following to be sure
    – the entire function
    – in a fresh WordPress install
    – on different hosting with a fresh theme
    – with only the absolute minimum plugins required and all up to date with the latest version
    – php version 5.6.31

    and am still getting the same error:
    Parse error: syntax error, unexpected ‘add_filter’ (T_STRING)

    for this line:
    add_filter( $filter_name, ‘tribe_export_custom_add_columns’, 100 );

    However I’ve tried adapting the function and regardless of how it is adapted it still continues to return errors.

    Unfortunately without this ability we won’t be able to proceed with using this plugin as it is critical for our CRM that we download the billing details with the tickets in the CSV. But I’m sure this is an implementation issue as others have managed this successfully!

    – I’m assuming this function should be placed in the functions.php file?
    – Would there be any conflict with this function and the latest versions of Event Tickets, Event Tickets Plus or WooCommerce that I am using?

    Many thanks for your help,

    Penny

    #1321177
    Andras
    Keymaster

    Hi Penny,

    I have checked that snippet from the original source and I also got the issue. It looks like when you copy-paste from there some invisible characters also get pasted which make the code corrupt.

    I cleaned it up and this one didn’t give me any errors any more. Try copying it from here:

    https://gist.github.com/andrasguseo/42ddab060677ec3dc8d18ff0438d39d1

    Let me know if this fixes it.

    Cheers,
    Andras

    #1321191
    Penny Scaffold
    Participant

    Hi,

    I cannot thank you enough, that worked perfectly getting the user ID! I am now struggling to get the WC billing address and info, which is the bit I really need.

    I’ve used the suggestion offered here:
    https://theeventscalendar.com/support/forums/topic/woocommerce-info-in-csv-export/#dl_post-1244383

    However the CSV is then full of the following:
    <b>Notice</b>: billing_first_name was called incorrectly. Order properties should not be accessed directly. Backtrace: require_once(‘wp-admin/admin.php’)
    <b>Notice</b>: billing_last_name was called incorrectly. Order properties should not be accessed directly. Backtrace: require_once(‘wp-admin/admin.php’)
    <b>Notice</b>: billing_address_1 was called incorrectly. Order properties should not be accessed directly. Backtrace: require_once(‘wp-admin/admin.php’)

    etc. which stems from

    $firstname = utf8_decode($order->billing_first_name);
    $lastname = utf8_decode($order->billing_last_name);
    $address = utf8_decode($order->billing_address_1) . ‘ / ‘ . $order->billing_postcode . ‘ / ‘ . utf8_decode($order->billing_city);

    I am guessing perhaps an update to WooCommerce or Tickets Plus since the article was written means we need to call billing_first_name etc. differently in order for this to work? I’d really very much appreciate any help – it is so close but I am at a loss at how to fix this!

    Thank you hugely,

    Penny

    #1322083
    Andras
    Keymaster

    Hi Penny,

    This is a bit beyond me so I will need to pull in some extra hands for this. It might take some time, so please hang in there.

    Thanks for your patience!

    Cheers,
    Andras

    #1322137
    Andras
    Keymaster

    Hi Penny,

    Managed to get some help / input for this from a team mate.

    Here are some practical changes you can do:

    – instead of $order->billing_first_name you can use $order->get_billing_first_name()

    – instead of $order->billing_last_name you can use $order->get_billing_first_name()

    – instead of $order->billing_address_1 you can use $order->get_billing_address_1()

    – … etc (in other words, switch from $order->FIELD to $order->get_FIELD()

     

    Please note that since this already heavily involves other plugins than ours, it is already at the limits of what we can provide within our support.

    If you will need further help with customization then I can share with you a list of freelancers who should be able to help you out further down the road.

    Cheers,
    Andras

    #1322315
    Penny Scaffold
    Participant

    Hi Andras,

    Thank you so much to you and your colleague for going over and above with this one – I managed to pull a load of extra columns using https://docs.woocommerce.com/wc-apidocs/class-WC_Abstract_Order.html based on the info you’ve given me.

    You’ve been awesome, thank you!

    Penny

    #1322687
    Andras
    Keymaster

    Hi Penny,

    I’m so happy to hear you managed to work it out! Awesome job!

    Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please post a new one in the forum and we will be happy to help you out.

    Good luck with your project!

    Cheers,
    Andras

    PS: If you like our plugins, and you didn’t yet do so 🙂 we would be happy to receive a review in the wordpress.org repository. Thanks!
    https://wordpress.org/support/plugin/the-events-calendar/reviews/
    https://wordpress.org/support/plugin/event-tickets/reviews/

    PS2: We’d be also grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Doublethanks!

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Woocommerce address field in CSV’ is closed to new replies.