Skip to content

Instantly share code, notes, and snippets.

@Pebblo Pebblo/csv_payments.php Secret
Created Feb 5, 2019

What would you like to do?
Example of how to break down the payments within a transaction and display each individual payment in the CSV.
<?php //Please do not include the opening PHP tag if you already have one
function tw_ee_espresso_reg_report_filter_columns_reg_paid( $csv_row, $registration_db_row ) {
$registration = EEM_Registration::instance()->get_one_by_ID($registration_db_row['Registration.REG_ID']);
$reg_payments = $registration->registration_payments();
if(!empty($reg_payments) ) {
//Set up our variables for use below.
$amount_paid = 0;
$individual_payments = array();
foreach($reg_payments as $reg_payment) {
//Loops through each payment on the registration and build out our variables.
$payment = $reg_payment->payment();
$amount_paid += $payment->amount();
$individual_payments[]= $payment->amount();
//Use the variables above to replace the current values in the CSV.
$csv_row['Amount Paid'] = $amount_paid . ' (' . implode(',', $individual_payments) . ')';
return $csv_row;
add_filter( 'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array', 'tw_ee_espresso_reg_report_filter_columns_reg_paid', 20, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.