-
-
Save Pebblo/0b0ac22e0b267b8e129b587142bdd997 to your computer and use it in GitHub Desktop.
Example of how to break down the payments within a transaction and display each individual payment in the CSV.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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