WC_Report_Customers::customers_vs_guests() public WC 1.0
Output customers vs guests chart.
{} Это метод класса: WC_Report_Customers{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$WC_Report_Customers = new WC_Report_Customers(); $WC_Report_Customers->customers_vs_guests();
Код WC_Report_Customers::customers_vs_guests() WC Report Customers::customers vs guests WC 5.0.0
public function customers_vs_guests() {
$customer_order_totals = $this->get_order_report_data(
array(
'data' => array(
'ID' => array(
'type' => 'post_data',
'function' => 'COUNT',
'name' => 'total_orders',
),
),
'where_meta' => array(
array(
'meta_key' => '_customer_user',
'meta_value' => '0',
'operator' => '>',
),
),
'filter_range' => true,
)
);
$guest_order_totals = $this->get_order_report_data(
array(
'data' => array(
'ID' => array(
'type' => 'post_data',
'function' => 'COUNT',
'name' => 'total_orders',
),
),
'where_meta' => array(
array(
'meta_key' => '_customer_user',
'meta_value' => '0',
'operator' => '=',
),
),
'filter_range' => true,
)
);
?>
<div class="chart-container">
<div class="chart-placeholder customers_vs_guests pie-chart" style="height:200px"></div>
<ul class="pie-chart-legend">
<li style="border-color: <?php echo esc_attr( $this->chart_colours['customers'] ); ?>"><?php esc_html_e( 'Customer sales', 'woocommerce' ); ?></li>
<li style="border-color: <?php echo esc_attr( $this->chart_colours['guests'] ); ?>"><?php esc_html_e( 'Guest sales', 'woocommerce' ); ?></li>
</ul>
</div>
<script type="text/javascript">
jQuery(function(){
jQuery.plot(
jQuery('.chart-placeholder.customers_vs_guests'),
[
{
label: '<?php esc_html_e( 'Customer orders', 'woocommerce' ); ?>',
data: "<?php echo esc_html( $customer_order_totals->total_orders ); ?>",
color: '<?php echo esc_html( $this->chart_colours['customers'] ); ?>'
},
{
label: '<?php esc_html_e( 'Guest orders', 'woocommerce' ); ?>',
data: "<?php echo esc_html( $guest_order_totals->total_orders ); ?>",
color: '<?php echo esc_html( $this->chart_colours['guests'] ); ?>'
}
],
{
grid: {
hoverable: true
},
series: {
pie: {
show: true,
radius: 1,
innerRadius: 0.6,
label: {
show: false
}
},
enable_tooltip: true,
append_tooltip: "<?php echo esc_html( ' ' . __( 'orders', 'woocommerce' ) ); ?>",
},
legend: {
show: false
}
}
);
jQuery('.chart-placeholder.customers_vs_guests').resize();
});
</script>
<?php
}