WC_Report_Sales_By_Date::get_chart_legend() public WC 1.0
Get the legend for the main chart sidebar.
{} Это метод класса: WC_Report_Sales_By_Date{}
Хуков нет.
Возвращает
Массив.
Использование
$WC_Report_Sales_By_Date = new WC_Report_Sales_By_Date(); $WC_Report_Sales_By_Date->get_chart_legend();
Код WC_Report_Sales_By_Date::get_chart_legend() WC Report Sales By Date::get chart legend WC 5.0.0
<?php
public function get_chart_legend() {
$legend = array();
$data = $this->get_report_data();
switch ( $this->chart_groupby ) {
case 'day':
$average_total_sales_title = sprintf(
/* translators: %s: average total sales */
__( '%s average gross daily sales', 'woocommerce' ),
'<strong>' . wc_price( $data->average_total_sales ) . '</strong>'
);
$average_sales_title = sprintf(
/* translators: %s: average sales */
__( '%s average net daily sales', 'woocommerce' ),
'<strong>' . wc_price( $data->average_sales ) . '</strong>'
);
break;
case 'month':
default:
$average_total_sales_title = sprintf(
/* translators: %s: average total sales */
__( '%s average gross monthly sales', 'woocommerce' ),
'<strong>' . wc_price( $data->average_total_sales ) . '</strong>'
);
$average_sales_title = sprintf(
/* translators: %s: average sales */
__( '%s average net monthly sales', 'woocommerce' ),
'<strong>' . wc_price( $data->average_sales ) . '</strong>'
);
break;
}
$legend[] = array(
'title' => sprintf(
/* translators: %s: total sales */
__( '%s gross sales in this period', 'woocommerce' ),
'<strong>' . wc_price( $data->total_sales ) . '</strong>'
),
'placeholder' => __( 'This is the sum of the order totals after any refunds and including shipping and taxes.', 'woocommerce' ),
'color' => $this->chart_colours['sales_amount'],
'highlight_series' => 6,
);
if ( $data->average_total_sales > 0 ) {
$legend[] = array(
'title' => $average_total_sales_title,
'color' => $this->chart_colours['average'],
'highlight_series' => 2,
);
}
$legend[] = array(
'title' => sprintf(
/* translators: %s: net sales */
__( '%s net sales in this period', 'woocommerce' ),
'<strong>' . wc_price( $data->net_sales ) . '</strong>'
),
'placeholder' => __( 'This is the sum of the order totals after any refunds and excluding shipping and taxes.', 'woocommerce' ),
'color' => $this->chart_colours['net_sales_amount'],
'highlight_series' => 7,
);
if ( $data->average_sales > 0 ) {
$legend[] = array(
'title' => $average_sales_title,
'color' => $this->chart_colours['net_average'],
'highlight_series' => 3,
);
}
$legend[] = array(
'title' => sprintf(
/* translators: %s: total orders */
__( '%s orders placed', 'woocommerce' ),
'<strong>' . $data->total_orders . '</strong>'
),
'color' => $this->chart_colours['order_count'],
'highlight_series' => 1,
);
$legend[] = array(
'title' => sprintf(
/* translators: %s: total items */
__( '%s items purchased', 'woocommerce' ),
'<strong>' . $data->total_items . '</strong>'
),
'color' => $this->chart_colours['item_count'],
'highlight_series' => 0,
);
$legend[] = array(
'title' => sprintf(
/* translators: 1: total refunds 2: total refunded orders 3: refunded items */
_n( '%1$s refunded %2$d order (%3$d item)', '%1$s refunded %2$d orders (%3$d items)', $this->report_data->total_refunded_orders, 'woocommerce' ),
'<strong>' . wc_price( $data->total_refunds ) . '</strong>',
$this->report_data->total_refunded_orders,
$this->report_data->refunded_order_items
),
'color' => $this->chart_colours['refund_amount'],
'highlight_series' => 8,
);
$legend[] = array(
'title' => sprintf(
/* translators: %s: total shipping */
__( '%s charged for shipping', 'woocommerce' ),
'<strong>' . wc_price( $data->total_shipping ) . '</strong>'
),
'color' => $this->chart_colours['shipping_amount'],
'highlight_series' => 5,
);
$legend[] = array(
'title' => sprintf(
/* translators: %s: total coupons */
__( '%s worth of coupons used', 'woocommerce' ),
'<strong>' . wc_price( $data->total_coupons ) . '</strong>'
),
'color' => $this->chart_colours['coupon_amount'],
'highlight_series' => 4,
);
return $legend;
}