You appear to be a bot. Output may be restricted
Description
Get the Export Data
Usage
$array = EDD_Batch_Payments_Export::get_data();
Parameters
Returns
array $data The data for the CSV file
Source
File name: easy-digital-downloads/includes/admin/reporting/export/class-batch-export-payments.php
Lines:
1 to 100 of 160
public function get_data() { global $wpdb; $data = array(); $args = array( 'number' => 30, 'page' => $this->step, 'status' => $this->status, 'order' => 'ASC', 'orderby' => 'date' ); if( ! empty( $this->start ) || ! empty( $this->end ) ) { $args['date_query'] = array( array( 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), 'inclusive' => true ) ); } $payments = edd_get_payments( $args ); if( $payments ) { foreach ( $payments as $payment ) { $payment = new EDD_Payment( $payment->ID ); $payment_meta = $payment->payment_meta; $user_info = $payment->user_info; $downloads = $payment->cart_details; $total = $payment->total; $user_id = isset( $user_info['id'] ) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email']; $products = ''; $products_raw = ''; $skus = ''; if ( $downloads ) { foreach ( $downloads as $key => $download ) { // Download ID $id = isset( $payment_meta['cart_details'] ) ? $download['id'] : $download; $qty = isset( $download['quantity'] ) ? $download['quantity'] : 1; if ( isset( $download['price'] ) ) { $price = $download['price']; } else { // If the download has variable prices, override the default price $price_override = isset( $payment_meta['cart_details'] ) ? $download['price'] : null; $price = edd_get_download_final_price( $id, $user_info, $price_override ); } $download_tax = isset( $download['tax'] ) ? $download['tax'] : 0; $download_price_id = isset( $download['item_number']['options']['price_id'] ) ? absint( $download['item_number']['options']['price_id'] ) : false; /* Set up verbose product column */ $products .= html_entity_decode( get_the_title( $id ) ); if ( $qty > 1 ) { $products .= html_entity_decode( ' (' . $qty . ')' ); } $products .= ' - '; if ( edd_use_skus() ) { $sku = edd_get_download_sku( $id ); if ( ! empty( $sku ) ) { $skus .= $sku; } } if ( isset( $downloads[ $key ]['item_number'] ) && isset( $downloads[ $key ]['item_number']['options'] ) ) { $price_options = $downloads[ $key ]['item_number']['options']; if ( isset( $price_options['price_id'] ) && ! is_null( $price_options['price_id'] ) ) { $products .= html_entity_decode( edd_get_price_option_name( $id, $price_options['price_id'], $payment->ID ) ) . ' - '; } } $products .= html_entity_decode( edd_currency_filter( edd_format_amount( $price ) ) ); if ( $key != ( count( $downloads ) -1 ) ) { $products .= ' / '; if( edd_use_skus() ) { $skus .= ' / '; } } /* Set up raw products column - Nothing but product names */ $products_raw .= html_entity_decode( get_the_title( $id ) ) . '|' . $price . '{' . $download_tax . '}'; // if we have a Price ID, include it. if ( false !== $download_price_id ) {