From 43e86f3e28761e666e45be9ca5f28f8cc6c1dd95 Mon Sep 17 00:00:00 2001 From: claudiosmweb Date: Tue, 21 Jan 2014 20:10:40 -0200 Subject: [PATCH 1/3] added a placeholder to select in category widget on reports page --- includes/admin/reports/class-wc-report-sales-by-category.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/reports/class-wc-report-sales-by-category.php b/includes/admin/reports/class-wc-report-sales-by-category.php index 5c238c5f4d1..954e66835ef 100644 --- a/includes/admin/reports/class-wc-report-sales-by-category.php +++ b/includes/admin/reports/class-wc-report-sales-by-category.php @@ -150,7 +150,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report { ?>
- Date: Tue, 21 Jan 2014 20:11:05 -0200 Subject: [PATCH 2/3] fixed the indentation in includes/admin/reports/class-wc-report-sales-by-category.php --- .../class-wc-report-sales-by-category.php | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/includes/admin/reports/class-wc-report-sales-by-category.php b/includes/admin/reports/class-wc-report-sales-by-category.php index 954e66835ef..58db1d72038 100644 --- a/includes/admin/reports/class-wc-report-sales-by-category.php +++ b/includes/admin/reports/class-wc-report-sales-by-category.php @@ -325,17 +325,17 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report { legend: { show: false }, - grid: { - color: '#aaa', - borderColor: 'transparent', - borderWidth: 0, - hoverable: true - }, - xaxes: [ { - color: '#aaa', - reserveSpace: true, - position: "bottom", - tickColor: 'transparent', + grid: { + color: '#aaa', + borderColor: 'transparent', + borderWidth: 0, + hoverable: true + }, + xaxes: [ { + color: '#aaa', + reserveSpace: true, + position: "bottom", + tickColor: 'transparent', mode: "time", timeformat: "chart_groupby == 'day' ) echo '%d %b'; else echo '%b'; ?>", monthNames: month_abbrev ) ) ?>, @@ -343,23 +343,23 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report { minTickSize: [1, "chart_groupby; ?>"], tickSize: [1, "chart_groupby; ?>"], font: { - color: "#aaa" - } + color: "#aaa" + } } ], - yaxes: [ - { - min: 0, - tickDecimals: 2, - color: 'transparent', - font: { color: "#aaa" } - } - ], - } - ); + yaxes: [ + { + min: 0, + tickDecimals: 2, + color: 'transparent', + font: { color: "#aaa" } + } + ], + } + ); - jQuery('.chart-placeholder').resize(); + jQuery('.chart-placeholder').resize(); - } + } drawGraph(); From b60629e9b4df8889f74c3ce8fbabec6fd70f585d Mon Sep 17 00:00:00 2001 From: claudiosmweb Date: Tue, 21 Jan 2014 20:14:26 -0200 Subject: [PATCH 3/3] fixed some coding standards in includes/admin/reports/class-wc-report-sales-by-category.php --- .../class-wc-report-sales-by-category.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/includes/admin/reports/class-wc-report-sales-by-category.php b/includes/admin/reports/class-wc-report-sales-by-category.php index 58db1d72038..4917ac66583 100644 --- a/includes/admin/reports/class-wc-report-sales-by-category.php +++ b/includes/admin/reports/class-wc-report-sales-by-category.php @@ -10,10 +10,11 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report { * Constructor */ public function __construct() { - if ( isset( $_GET['show_categories'] ) && is_array( $_GET['show_categories'] ) ) + if ( isset( $_GET['show_categories'] ) && is_array( $_GET['show_categories'] ) ) { $this->show_categories = array_map( 'absint', $_GET['show_categories'] ); - elseif ( isset( $_GET['show_categories'] ) ) + } elseif ( isset( $_GET['show_categories'] ) ) { $this->show_categories = array( absint( $_GET['show_categories'] ) ); + } } /** @@ -21,13 +22,14 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report { * @return array */ public function get_chart_legend() { - if ( ! $this->show_categories ) + if ( ! $this->show_categories ) { return array(); + } $legend = array(); $index = 0; - foreach( $this->show_categories as $category ) { + foreach ( $this->show_categories as $category ) { $category = get_term( $category, 'product_cat' ); $term_ids = get_term_children( $category->term_id, 'product_cat' ); $term_ids[] = $category->term_id; @@ -72,8 +74,9 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report { $current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : '7day'; - if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) + if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) { $current_range = '7day'; + } $this->calculate_current_range( $current_range ); @@ -125,7 +128,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report { } } - include( WC()->plugin_path() . '/includes/admin/views/html-report-by-date.php'); + include( WC()->plugin_path() . '/includes/admin/views/html-report-by-date.php' ); } /** @@ -338,7 +341,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report { tickColor: 'transparent', mode: "time", timeformat: "chart_groupby == 'day' ) echo '%d %b'; else echo '%b'; ?>", - monthNames: month_abbrev ) ) ?>, + monthNames: month_abbrev ) ); ?>, tickLength: 1, minTickSize: [1, "chart_groupby; ?>"], tickSize: [1, "chart_groupby; ?>"],