/** * Build all the reports data * * @access public * @since 1.5 * @return array $reports_data All the data for customer reports */ public function reports_data() { $reports_data = array(); $downloads = $this->products->posts; $download_ids = $this->products->query_vars['post__in']; if (!empty($download_ids)) { foreach ($downloads as $download) { global $edd_logs; $reports_data[] = array('ID' => $download, 'title' => get_the_title($download), 'sales' => edd_csau_get_download_sales_stats($download, $this->type), 'earnings' => edd_csau_get_download_earnings_stats($download, $this->type)); } } return $reports_data; }
/** * Decreases the sale count of a cross-sell/upsell download. Primarily for when a purchase is * refunded. * * @since 1.1 * @param int $download_id Download ID * @return void */ function edd_csau_decrease_purchase_count($download_id, $type) { $sales = edd_csau_get_download_sales_stats($download_id, $type); if ($sales > 0) { // Only decrease if not already zero $sales = $sales - 1; } if (update_post_meta($download_id, '_edd_download_' . $type . '_sales', $sales)) { return $sales; } return false; }