WC_Report_Coupon_Usage
extends WC_Admin_Report
in package
WC_Report_Coupon_Usage
Tags
Table of Contents
- $barwidth : int
- The bar width.
- $chart_colours : array<string|int, mixed>
- Chart colors.
- $chart_groupby : string
- Group chart item by day or month.
- $chart_interval : int
- The chart interval.
- $coupon_codes : array<string|int, mixed>
- Coupon codes.
- $end_date : int
- The end date of the report.
- $group_by_query : string
- Group by SQL query.
- $start_date : int
- The start date of the report.
- $cached_results : array<string|int, mixed>
- The list of transients.
- $transients_to_update : array<string|int, mixed>
- List of transients name that have been updated and need persisting.
- __construct() : mixed
- Constructor.
- calculate_current_range() : mixed
- Get the current range and calculate the start and end dates.
- check_current_range_nonce() : mixed
- Check nonce for current range.
- coupons_widget() : mixed
- Output coupons widget.
- get_chart_legend() : array<string|int, mixed>
- Get the legend for the main chart sidebar.
- get_chart_widgets() : array<string|int, mixed>
- Get chart widgets.
- get_currency_tooltip() : string
- Return currency tooltip JS based on WooCommerce currency position settings.
- get_export_button() : mixed
- Output an export link.
- get_main_chart() : mixed
- Get the main chart.
- get_order_report_data() : mixed
- Get report totals such as order totals and discount amounts.
- maybe_update_transients() : mixed
- Function to update the modified transients at the end of the request.
- output_report() : mixed
- Output the report.
- prepare_chart_data() : array<string|int, mixed>
- Put data with post_date's into an array of times.
- sales_sparkline() : string
- Prepares a sparkline to show sales in the last X days.
- add_update_transients_hook() : mixed
- Init the static hooks of the class.
- enable_big_selects() : mixed
- Enables big mysql selects for reports, just once for this session.
- get_cached_query() : mixed
- Get the cached query result or null if it's not in the cache.
- set_cached_query() : mixed
- Set the cached query result.
Properties
$barwidth
The bar width.
public
int
$barwidth
$chart_colours
Chart colors.
public
array<string|int, mixed>
$chart_colours
= array()
$chart_groupby
Group chart item by day or month.
public
string
$chart_groupby
$chart_interval
The chart interval.
public
int
$chart_interval
$coupon_codes
Coupon codes.
public
array<string|int, mixed>
$coupon_codes
= array()
$end_date
The end date of the report.
public
int
$end_date
$group_by_query
Group by SQL query.
public
string
$group_by_query
$start_date
The start date of the report.
public
int
$start_date
$cached_results
The list of transients.
protected
static array<string|int, mixed>
$cached_results
= array()
$transients_to_update
List of transients name that have been updated and need persisting.
protected
static array<string|int, mixed>
$transients_to_update
= array()
Methods
__construct()
Constructor.
public
__construct() : mixed
Return values
mixed —calculate_current_range()
Get the current range and calculate the start and end dates.
public
calculate_current_range(string $current_range) : mixed
Parameters
- $current_range : string
-
Type of range.
Return values
mixed —check_current_range_nonce()
Check nonce for current range.
public
check_current_range_nonce(string $current_range) : mixed
Parameters
- $current_range : string
-
Current range.
Tags
Return values
mixed —coupons_widget()
Output coupons widget.
public
coupons_widget() : mixed
Return values
mixed —get_chart_legend()
Get the legend for the main chart sidebar.
public
get_chart_legend() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_chart_widgets()
Get chart widgets.
public
get_chart_widgets() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_currency_tooltip()
Return currency tooltip JS based on WooCommerce currency position settings.
public
get_currency_tooltip() : string
Return values
string —get_export_button()
Output an export link.
public
get_export_button() : mixed
Return values
mixed —get_main_chart()
Get the main chart.
public
get_main_chart() : mixed
Return values
mixed —get_order_report_data()
Get report totals such as order totals and discount amounts.
public
get_order_report_data([array<string|int, mixed> $args = array() ]) : mixed
Data example:
'_order_total' => array( 'type' => 'meta', 'function' => 'SUM', 'name' => 'total_sales' )
Parameters
- $args : array<string|int, mixed> = array()
-
arguments for the report.
Return values
mixed — depending on query_typemaybe_update_transients()
Function to update the modified transients at the end of the request.
public
static maybe_update_transients() : mixed
Return values
mixed —output_report()
Output the report.
public
output_report() : mixed
Return values
mixed —prepare_chart_data()
Put data with post_date's into an array of times.
public
prepare_chart_data(array<string|int, mixed> $data, string $date_key, string $data_key, int $interval, string $start_date, string $group_by) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
array of your data.
- $date_key : string
-
key for the 'date' field. e.g. 'post_date'.
- $data_key : string
-
key for the data you are charting.
- $interval : int
-
interval to use.
- $start_date : string
-
start date.
- $group_by : string
-
group by.
Return values
array<string|int, mixed> —sales_sparkline()
Prepares a sparkline to show sales in the last X days.
public
sales_sparkline([int $id = '' ][, int $days = 7 ][, string $type = 'sales' ]) : string
Parameters
- $id : int = ''
-
ID of the product to show. Blank to get all orders.
- $days : int = 7
-
Days of stats to get.
- $type : string = 'sales'
-
Type of sparkline to get. Ignored if ID is not set.
Return values
string —add_update_transients_hook()
Init the static hooks of the class.
protected
static add_update_transients_hook() : mixed
Return values
mixed —enable_big_selects()
Enables big mysql selects for reports, just once for this session.
protected
static enable_big_selects() : mixed
Return values
mixed —get_cached_query()
Get the cached query result or null if it's not in the cache.
protected
get_cached_query(string $query_hash) : mixed
Parameters
- $query_hash : string
-
The query hash.
Return values
mixed —set_cached_query()
Set the cached query result.
protected
set_cached_query(string $query_hash, mixed $data) : mixed
Parameters
- $query_hash : string
-
The query hash.
- $data : mixed
-
The data to cache.