Support

Home Forums Event Espresso Premium EE4 Adding Custom Registration CSV Export

EE4 Adding Custom Registration CSV Export

Posted: February 7, 2016 at 1:49 pm

Viewing 2 reply threads


goingsmart

February 7, 2016 at 1:49 pm

I have researched this on the forum and see where people have used filters in their site customization area to modify the standard CSV. Some approaches delete fields, some only allow certain fields. Also want to add Event Category Name and use the names for Registration and Transaction Status but not sure about their Array Names. Additionally, want to change the sequence of fields in the CSV. Is this possible without modifying Core PHP.
COMMENTS ON MY CODE (WHICH IS BASED ON A FORUM POSTING) ARE WELCOME:
// only include these 22 columns in the Registrations CSV output in the sequence specified
// also adding Event Category Name
add_filter( ‘FHEE__EE_Export__report_registrations__reg_csv_array’, ‘espresso_reg_report_filter_columns’, 10, 2);
function espresso_reg_report_filter_columns( $csv_row, $registration_db_row ) {
$filtered_csv_row = array_intersect_key(
$csv_row,
array_flip( array(
__( ‘Event[EVT_name]’, ‘event_espresso’ ),
__( ‘Ticket Name[TKT_name]’, ‘event_espresso’ ),
__( ‘Ticket Datetimes[DTT_EVT_start]’, ‘event_espresso’ ),
__( ‘Check-Ins[Check-Ins]’, ‘event_espresso’ ),
__( ‘Reg Status[REG_desc]’, ‘event_espresso’ ),
__( ‘Trans Status[TXN_desc]’, ‘event_espresso’ ),
__( ‘Last Name[ATT_lname]’, ‘event_espresso’ ),
__( ‘First Name[ATT_fname]’, ‘event_espresso’ ),
__( ‘Email Address[ATT_email]’, ‘event_espresso’ ),
__( ‘Phone[ATT_phone]’, ‘event_espresso’ ),
__( ‘Trans ID[TXN_ID]’, ‘event_espresso’ ),
__( ‘Trans AMT[TXN_total]’, ‘event_espresso’ ),
__( ‘Paid AMT[TXN_paid]’, ‘event_espresso’ ),
__( ‘Date Paid[ATT_phone]’, ‘event_espresso’ ),
__( ‘Promo[TXN_????]’, ‘event_espresso’ ),
__( ‘Address-1[ATT_address]’, ‘event_espresso’ ),
__( ‘Address-2[ATT_address2]’, ‘event_espresso’ ),
__( ‘City[ATT_city]’, ‘event_espresso’ ),
__( ‘State[STA_ID]’, ‘event_espresso’ ),
__( ‘Zip[ATT_zip]’, ‘event_espresso’ ),
__( ‘Country[CNT_ISO]’, ‘event_espresso’ ),
__( ‘Category[EVT_CAT_name]’, ‘event_espresso’ )
) ) );
return $filtered_csv_row;
}


goingsmart

February 7, 2016 at 1:55 pm

UPDATE: also want any Promotion Data but don’t know array name in EE_Export.class.php


Tony

  • Support Staff

February 8, 2016 at 11:20 am

Hi there,

Have you altered the names of the fields within Event Espresso?

The reason I ask is most of the above code will not work, for example there is no ‘Trans ID[TXN_ID]’ field output within the CSV by default. (It should just be ‘Transaction ID’)

The previous example you have used to build the above is to allow you to specify the fields that are allowed to be written to the CSV. The filter is passed a variable ($cvs_row) that contains all of the data EE has pulled in for the CSV it then sets which keys are allowed to go through using the array_intersect_key() function.

array_intersect_key() takes 2 arrays of data, compares them and returns the value from the first array that matches the keys in the second.

So it basically allows you to delete fields from the CSV array before its sent to the CSV.

It is possible to add additional details to the CSV in this way to, but you would need to pull that information in and add it to the array to be written to the CSV.

Viewing 2 reply threads

The support post ‘EE4 Adding Custom Registration CSV Export’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso