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.0.9 6.2.0-rc.2 3.1.0 6.2.1 3.1.1 6.2.2 3.1.2 6.2.3 3.2.0 6.3.0 3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / admin / reports / class-wc-report-customers.php
woocommerce / includes / admin / reports Last commit date
class-wc-admin-report.php 1 year ago class-wc-report-coupon-usage.php 5 years ago class-wc-report-customer-list.php 9 months ago class-wc-report-customers.php 9 months ago class-wc-report-downloads.php 5 years ago class-wc-report-low-in-stock.php 5 years ago class-wc-report-most-stocked.php 5 years ago class-wc-report-out-of-stock.php 5 years ago class-wc-report-sales-by-category.php 2 years ago class-wc-report-sales-by-date.php 1 year ago class-wc-report-sales-by-product.php 3 months ago class-wc-report-stock.php 1 year ago class-wc-report-taxes-by-code.php 1 year ago class-wc-report-taxes-by-date.php 1 year ago
class-wc-report-customers.php
425 lines
1 <?php
2 /**
3 * Class WC_Report_Customers file.
4 *
5 * @package WooCommerce\Reports
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly.
10 }
11
12 /**
13 * WC_Report_Customers
14 *
15 * @package WooCommerce\Admin\Reports
16 * @version 2.1.0
17 */
18 class WC_Report_Customers extends WC_Admin_Report {
19
20 /**
21 * Chart colors.
22 *
23 * @var array
24 */
25 public $chart_colours = array();
26
27 /**
28 * Customers.
29 *
30 * @var array
31 */
32 public $customers = array();
33
34 /**
35 * Get the legend for the main chart sidebar.
36 *
37 * @return array
38 */
39 public function get_chart_legend() {
40 $legend = array();
41
42 $legend[] = array(
43 /* translators: %s: signups amount */
44 'title' => sprintf( __( '%s signups in this period', 'woocommerce' ), '<strong>' . count( $this->customers ) . '</strong>' ),
45 'color' => $this->chart_colours['signups'],
46 'highlight_series' => 2,
47 );
48
49 return $legend;
50 }
51
52 /**
53 * Get chart widgets.
54 *
55 * @return array
56 */
57 public function get_chart_widgets() {
58 $widgets = array();
59
60 $widgets[] = array(
61 'title' => '',
62 'callback' => array( $this, 'customers_vs_guests' ),
63 );
64
65 return $widgets;
66 }
67
68 /**
69 * Output customers vs guests chart.
70 */
71 public function customers_vs_guests() {
72
73 $customer_order_totals = $this->get_order_report_data(
74 array(
75 'data' => array(
76 'ID' => array(
77 'type' => 'post_data',
78 'function' => 'COUNT',
79 'name' => 'total_orders',
80 ),
81 ),
82 'where_meta' => array(
83 array(
84 'meta_key' => '_customer_user',
85 'meta_value' => '0',
86 'operator' => '>',
87 ),
88 ),
89 'filter_range' => true,
90 )
91 );
92
93 $guest_order_totals = $this->get_order_report_data(
94 array(
95 'data' => array(
96 'ID' => array(
97 'type' => 'post_data',
98 'function' => 'COUNT',
99 'name' => 'total_orders',
100 ),
101 ),
102 'where_meta' => array(
103 array(
104 'meta_key' => '_customer_user',
105 'meta_value' => '0',
106 'operator' => '=',
107 ),
108 ),
109 'filter_range' => true,
110 )
111 );
112 ?>
113 <div class="chart-container">
114 <div class="chart-placeholder customers_vs_guests pie-chart" style="height:200px"></div>
115 <ul class="pie-chart-legend">
116 <li style="border-color: <?php echo esc_attr( $this->chart_colours['customers'] ); ?>"><?php esc_html_e( 'Customer sales', 'woocommerce' ); ?></li>
117 <li style="border-color: <?php echo esc_attr( $this->chart_colours['guests'] ); ?>"><?php esc_html_e( 'Guest sales', 'woocommerce' ); ?></li>
118 </ul>
119 </div>
120 <script type="text/javascript">
121 jQuery(function(){
122 jQuery.plot(
123 jQuery('.chart-placeholder.customers_vs_guests'),
124 [
125 {
126 label: '<?php esc_html_e( 'Customer orders', 'woocommerce' ); ?>',
127 data: "<?php echo esc_html( $customer_order_totals->total_orders ); ?>",
128 color: '<?php echo esc_html( $this->chart_colours['customers'] ); ?>'
129 },
130 {
131 label: '<?php esc_html_e( 'Guest orders', 'woocommerce' ); ?>',
132 data: "<?php echo esc_html( $guest_order_totals->total_orders ); ?>",
133 color: '<?php echo esc_html( $this->chart_colours['guests'] ); ?>'
134 }
135 ],
136 {
137 grid: {
138 hoverable: true
139 },
140 series: {
141 pie: {
142 show: true,
143 radius: 1,
144 innerRadius: 0.6,
145 label: {
146 show: false
147 }
148 },
149 enable_tooltip: true,
150 append_tooltip: "<?php echo esc_html( ' ' . __( 'orders', 'woocommerce' ) ); ?>",
151 },
152 legend: {
153 show: false
154 }
155 }
156 );
157
158 jQuery('.chart-placeholder.customers_vs_guests').trigger( 'resize' );
159 });
160 </script>
161 <?php
162 }
163
164 /**
165 * Output the report.
166 */
167 public function output_report() {
168
169 $ranges = array(
170 'year' => __( 'Year', 'woocommerce' ),
171 'last_month' => __( 'Last month', 'woocommerce' ),
172 'month' => __( 'This month', 'woocommerce' ),
173 '7day' => __( 'Last 7 days', 'woocommerce' ),
174 );
175
176 $this->chart_colours = array(
177 'signups' => '#3498db',
178 'customers' => '#1abc9c',
179 'guests' => '#8fdece',
180 );
181
182 $current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day';
183
184 if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ), true ) ) {
185 $current_range = '7day';
186 }
187
188 $this->check_current_range_nonce( $current_range );
189 $this->calculate_current_range( $current_range );
190
191 $privileged_users = new WP_User_Query(
192 array(
193 'fields' => 'ID',
194 'role__in' => array( 'administrator', 'shop_manager' ),
195 ),
196 );
197 $users_query = new WP_User_Query(
198 apply_filters(
199 'woocommerce_admin_report_customers_user_query_args',
200 array(
201 'fields' => array( 'user_registered' ),
202 'exclude' => $privileged_users->get_results(),
203 )
204 )
205 );
206
207 $this->customers = $users_query->get_results();
208
209 foreach ( $this->customers as $key => $customer ) {
210 if ( strtotime( $customer->user_registered ) < $this->start_date || strtotime( $customer->user_registered ) > $this->end_date ) {
211 unset( $this->customers[ $key ] );
212 }
213 }
214
215 include WC()->plugin_path() . '/includes/admin/views/html-report-by-date.php';
216 }
217
218 /**
219 * Output an export link.
220 */
221 public function get_export_button() {
222
223 $current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day';
224 ?>
225 <a
226 href="#"
227 download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo esc_attr( date_i18n( 'Y-m-d', current_time( 'timestamp' ) ) ); ?>.csv"
228 class="export_csv"
229 data-export="chart"
230 data-xaxes="<?php esc_attr_e( 'Date', 'woocommerce' ); ?>"
231 data-groupby="<?php echo esc_attr( $this->chart_groupby ); ?>"
232 >
233 <?php esc_html_e( 'Export CSV', 'woocommerce' ); ?>
234 </a>
235 <?php
236 }
237
238 /**
239 * Output the main chart.
240 */
241 public function get_main_chart() {
242 global $wp_locale;
243
244 $customer_orders = $this->get_order_report_data(
245 array(
246 'data' => array(
247 'ID' => array(
248 'type' => 'post_data',
249 'function' => 'COUNT',
250 'name' => 'total_orders',
251 ),
252 'post_date' => array(
253 'type' => 'post_data',
254 'function' => '',
255 'name' => 'post_date',
256 ),
257 ),
258 'where_meta' => array(
259 array(
260 'meta_key' => '_customer_user',
261 'meta_value' => '0',
262 'operator' => '>',
263 ),
264 ),
265 'group_by' => $this->group_by_query,
266 'order_by' => 'post_date ASC',
267 'query_type' => 'get_results',
268 'filter_range' => true,
269 )
270 );
271
272 $guest_orders = $this->get_order_report_data(
273 array(
274 'data' => array(
275 'ID' => array(
276 'type' => 'post_data',
277 'function' => 'COUNT',
278 'name' => 'total_orders',
279 ),
280 'post_date' => array(
281 'type' => 'post_data',
282 'function' => '',
283 'name' => 'post_date',
284 ),
285 ),
286 'where_meta' => array(
287 array(
288 'meta_key' => '_customer_user',
289 'meta_value' => '0',
290 'operator' => '=',
291 ),
292 ),
293 'group_by' => $this->group_by_query,
294 'order_by' => 'post_date ASC',
295 'query_type' => 'get_results',
296 'filter_range' => true,
297 )
298 );
299
300 $signups = $this->prepare_chart_data( $this->customers, 'user_registered', '', $this->chart_interval, $this->start_date, $this->chart_groupby );
301 $customer_orders = $this->prepare_chart_data( $customer_orders, 'post_date', 'total_orders', $this->chart_interval, $this->start_date, $this->chart_groupby );
302 $guest_orders = $this->prepare_chart_data( $guest_orders, 'post_date', 'total_orders', $this->chart_interval, $this->start_date, $this->chart_groupby );
303
304 $chart_data = wp_json_encode(
305 array(
306 'signups' => array_values( $signups ),
307 'customer_orders' => array_values( $customer_orders ),
308 'guest_orders' => array_values( $guest_orders ),
309 )
310 );
311 ?>
312 <div class="chart-container">
313 <div class="chart-placeholder main"></div>
314 </div>
315 <script type="text/javascript">
316 var main_chart;
317
318 jQuery(function(){
319 var chart_data = JSON.parse( decodeURIComponent( '<?php echo rawurlencode( $chart_data ); ?>' ) );
320
321 var drawGraph = function( highlight ) {
322 var series = [
323 {
324 label: "<?php echo esc_js( __( 'Customer orders', 'woocommerce' ) ); ?>",
325 data: chart_data.customer_orders,
326 color: '<?php echo esc_html( $this->chart_colours['customers'] ); ?>',
327 bars: { fillColor: '<?php echo esc_html( $this->chart_colours['customers'] ); ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo esc_html( $this->barwidth ); ?> * 0.5, align: 'center' },
328 shadowSize: 0,
329 enable_tooltip: true,
330 append_tooltip: "<?php echo esc_html( ' ' . __( 'customer orders', 'woocommerce' ) ); ?>",
331 stack: true,
332 },
333 {
334 label: "<?php echo esc_js( __( 'Guest orders', 'woocommerce' ) ); ?>",
335 data: chart_data.guest_orders,
336 color: '<?php echo esc_html( $this->chart_colours['guests'] ); ?>',
337 bars: { fillColor: '<?php echo esc_html( $this->chart_colours['guests'] ); ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo esc_html( $this->barwidth ); ?> * 0.5, align: 'center' },
338 shadowSize: 0,
339 enable_tooltip: true,
340 append_tooltip: "<?php echo esc_html( ' ' . __( 'guest orders', 'woocommerce' ) ); ?>",
341 stack: true,
342 },
343 {
344 label: "<?php echo esc_js( __( 'Signups', 'woocommerce' ) ); ?>",
345 data: chart_data.signups,
346 color: '<?php echo esc_html( $this->chart_colours['signups'] ); ?>',
347 points: { show: true, radius: 5, lineWidth: 3, fillColor: '#fff', fill: true },
348 lines: { show: true, lineWidth: 4, fill: false },
349 shadowSize: 0,
350 enable_tooltip: true,
351 append_tooltip: "<?php echo esc_html( ' ' . __( 'new users', 'woocommerce' ) ); ?>",
352 stack: false
353 },
354 ];
355
356 if ( highlight !== 'undefined' && series[ highlight ] ) {
357 highlight_series = series[ highlight ];
358
359 highlight_series.color = '#9c5d90';
360
361 if ( highlight_series.bars )
362 highlight_series.bars.fillColor = '#9c5d90';
363
364 if ( highlight_series.lines ) {
365 highlight_series.lines.lineWidth = 5;
366 }
367 }
368
369 main_chart = jQuery.plot(
370 jQuery('.chart-placeholder.main'),
371 series,
372 {
373 legend: {
374 show: false
375 },
376 grid: {
377 color: '#aaa',
378 borderColor: 'transparent',
379 borderWidth: 0,
380 hoverable: true
381 },
382 xaxes: [ {
383 color: '#aaa',
384 position: "bottom",
385 tickColor: 'transparent',
386 mode: "time",
387 timeformat: "<?php echo ( 'day' === $this->chart_groupby ) ? '%d %b' : '%b'; ?>",
388 monthNames: JSON.parse( decodeURIComponent( '<?php echo rawurlencode( wp_json_encode( array_values( $wp_locale->month_abbrev ) ) ); ?>' ) ),
389 tickLength: 1,
390 minTickSize: [1, "<?php echo esc_html( $this->chart_groupby ); ?>"],
391 tickSize: [1, "<?php echo esc_html( $this->chart_groupby ); ?>"],
392 font: {
393 color: "#aaa"
394 }
395 } ],
396 yaxes: [
397 {
398 min: 0,
399 minTickSize: 1,
400 tickDecimals: 0,
401 color: '#ecf0f1',
402 font: { color: "#aaa" }
403 }
404 ],
405 }
406 );
407 jQuery('.chart-placeholder').trigger( 'resize' );
408 }
409
410 drawGraph();
411
412 jQuery('.highlight_series').on( 'mouseenter',
413 function() {
414 drawGraph( jQuery(this).data('series') );
415 } ).on( 'mouseleave',
416 function() {
417 drawGraph();
418 }
419 );
420 });
421 </script>
422 <?php
423 }
424 }
425