{"id":1463538,"date":"2018-02-26T03:19:22","date_gmt":"2018-02-26T11:19:22","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/"},"modified":"2018-02-26T03:19:22","modified_gmt":"2018-02-26T11:19:22","slug":"custom-add-columns-function-for-csv-export-is-preventing-export","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/","title":{"rendered":"Custom &quot;add columns&quot; function for CSV export is preventing export"},"content":{"rendered":"<p>Hi,<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>This morning, with more ticket sales over the weekend, it is now failing to export again.<\/p>\n<p>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?<\/p>\n<p>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).<\/p>\n<p>I urgently need to resolve this export issue at the very least as we have ticket data we cannot import into our database.<\/p>\n<p>Your assistance is greatly appreciated.<\/p>\n<p>Many thanks,<\/p>\n<p>Penny<\/p>\n<p>\/<em>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/em>\/<br \/>\n\/* TRIBE<br \/>\n\/<em>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/em>\/<\/p>\n<p>function tribe_export_custom_set_up ( $event_id ) {<br \/>\n  \/\/Add Handler for Community Tickets to Prevent Notices in Exports<\/p>\n<p>if ( ! is_admin() ) {<br \/>\n    $screen_base = &#8216;tribe_events_page_tickets-attendees&#8217;;<\/p>\n<p>} else {<br \/>\n    $screen      = get_current_screen();<br \/>\n    $screen_base = $screen-&gt;base;<br \/>\n  }<\/p>\n<p>$filter_name = &#8220;manage_{$screen_base}_columns&#8221;;<\/p>\n<p>add_filter( $filter_name, &#8216;tribe_export_custom_add_columns&#8217;, 100 );<br \/>\n  add_filter( &#8216;tribe_events_tickets_attendees_table_column&#8217;, &#8216;tribe_export_custom_populate_columns&#8217;, 10, 3 );<br \/>\n}<br \/>\nadd_action( &#8216;tribe_events_tickets_generate_filtered_attendees_list&#8217;, &#8216;tribe_export_custom_set_up&#8217; );<\/p>\n<p>function tribe_export_custom_add_columns ( $columns ) {<br \/>\n  $columns[&#8216;wc_first_name&#8217;] = &#8216;First Name&#8217;;<br \/>\n  $columns[&#8216;wc_last_name&#8217;] = &#8216;Last Name&#8217;;<br \/>\n  $columns[&#8216;wc_address_1&#8217;] = &#8216;Address line 1&#8217;;<br \/>\n  $columns[&#8216;wc_address_2&#8217;] = &#8216;Address line 2&#8217;;<br \/>\n  $columns[&#8216;wc_address_city&#8217;] = &#8216;Address city&#8217;;<br \/>\n  $columns[&#8216;wc_address_state&#8217;] = &#8216;Address state&#8217;;<br \/>\n  $columns[&#8216;wc_address_postcode&#8217;] = &#8216;Address postcode&#8217;;<br \/>\n  $columns[&#8216;wc_payment&#8217;] = &#8216;Payment&#8217;;<br \/>\n  $columns[&#8216;wc_date&#8217;] = &#8216;Date&#8217;;<br \/>\n  return $columns;<br \/>\n}<\/p>\n<p>function tribe_export_custom_populate_columns ( $value, $item, $column ) {<\/p>\n<p>$order = new WC_Order( $item[&#8216;order_id&#8217;] );<\/p>\n<p>$firstname = utf8_decode($order-&gt;get_billing_first_name());<br \/>\n$lastname = utf8_decode($order-&gt;get_billing_last_name());<br \/>\n$address1 = utf8_decode($order-&gt;get_billing_address_1());<br \/>\n$address2 = utf8_decode($order-&gt;get_billing_address_2());<br \/>\n$addresscity = utf8_decode($order-&gt;get_billing_city());<br \/>\n$addressstate = utf8_decode($order-&gt;get_billing_state());<br \/>\n$addresspostcode = utf8_decode($order-&gt;get_billing_postcode());<br \/>\n$payment = utf8_decode($order-&gt;get_payment_method());<br \/>\n$datecreated = utf8_decode($order-&gt;get_date_created());<\/p>\n<p>if ( isset($order) ) {<\/p>\n<pre><code>switch ($column) {    \ncase 'wc_first_name':\n        $value = $firstname;\n    break;\ncase 'wc_last_name':\n        $value = $lastname;\n    break;\ncase 'wc_address_1':\n        $value = $address1;\n    break;\ncase 'wc_address_2':\n        $value = $address2;\n    break;\ncase 'wc_address_city':\n        $value = $addresscity;\n    break;\n case 'wc_address_state':\n        $value = $addressstate;\n    break;    \n case 'wc_address_postcode':\n        $value = $addresspostcode;\n    break;\ncase 'wc_payment':\n        $value = $payment;\n    break;\ncase 'wc_date':\n        $value = $datecreated;\n    break;\n<\/code><\/pre>\n<p>}<br \/>\n    } else {<br \/>\n        $value = &#8216;-&#8216;;<br \/>\n    }<br \/>\n    return $value;<br \/>\n}<\/p>\n","protected":false},"template":"","class_list":["post-1463538","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Custom &quot;add columns&quot; function for CSV export is preventing export -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom &quot;add columns&quot; function for CSV export is preventing export -\" \/>\n<meta property=\"og:description\" content=\"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 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/\",\"name\":\"Custom &quot;add columns&quot; function for CSV export is preventing export -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2018-02-26T11:19:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Ticket Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Event Tickets Plus\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Custom &quot;add columns&quot; function for CSV export is preventing export\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Custom &quot;add columns&quot; function for CSV export is preventing export -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/","og_locale":"en_US","og_type":"article","og_title":"Custom &quot;add columns&quot; function for CSV export is preventing export -","og_description":"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 [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/","name":"Custom &quot;add columns&quot; function for CSV export is preventing export -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2018-02-26T11:19:22+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-add-columns-function-for-csv-export-is-preventing-export\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Ticket Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/"},{"@type":"ListItem","position":4,"name":"Event Tickets Plus","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/"},{"@type":"ListItem","position":5,"name":"Custom &quot;add columns&quot; function for CSV export is preventing export"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1463538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1463538\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1463538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}