From c9e61eef82a010f838c2997a3f08fe3cb278ae7d Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Sun, 30 Sep 2012 19:35:05 +0100 Subject: [PATCH] Reports fix when beginning with a number. --- admin/woocommerce-admin-reports.php | 8 ++++---- readme.txt | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/admin/woocommerce-admin-reports.php b/admin/woocommerce-admin-reports.php index 6e34ac57de5..457df31f068 100644 --- a/admin/woocommerce-admin-reports.php +++ b/admin/woocommerce-admin-reports.php @@ -2148,7 +2148,7 @@ function woocommerce_category_sales() { $data ) { - $varname = str_replace( '-', '_', sanitize_title( $name ) ) . '_data'; + $varname = 'cat_' . str_replace( '-', '_', sanitize_title( $name ) ) . '_data'; echo 'var ' . $varname . ' = jQuery.parseJSON( \'' . json_encode( $data ) . '\' );'; } ?> @@ -2160,7 +2160,7 @@ function woocommerce_category_sales() { $labels = array(); foreach ( $chart_data as $name => $data ) { - $labels[] = '{ label: "' . esc_js( $name ) . '", data: ' . str_replace( '-', '_', sanitize_title( $name ) ) . '_data }'; + $labels[] = '{ label: "' . esc_js( $name ) . '", data: ' . 'cat_' . str_replace( '-', '_', sanitize_title( $name ) ) . '_data }'; } echo implode( ',', $labels ); @@ -2446,7 +2446,7 @@ function woocommerce_coupon_sales() { $data ) { - $varname = str_replace( '-', '_', sanitize_title( $name ) ) . '_data'; + $varname = 'coupon_' . str_replace( '-', '_', sanitize_title( $name ) ) . '_data'; echo 'var ' . $varname . ' = jQuery.parseJSON( \'' . json_encode( $data ) . '\' );'; } ?> @@ -2458,7 +2458,7 @@ function woocommerce_coupon_sales() { $labels = array(); foreach ( $chart_data as $name => $data ) { - $labels[] = '{ label: "' . esc_js( $name ) . '", data: ' . str_replace( '-', '_', sanitize_title( $name ) ) . '_data }'; + $labels[] = '{ label: "' . esc_js( $name ) . '", data: ' . 'coupon_' . str_replace( '-', '_', sanitize_title( $name ) ) . '_data }'; } echo implode( ',', $labels ); diff --git a/readme.txt b/readme.txt index c6bff34a5d5..d192bc16ac3 100644 --- a/readme.txt +++ b/readme.txt @@ -152,6 +152,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc = 1.7.0 = * Feature - Added sales by category report. +* Feature - Added sales by coupon report (kudos Max Rice). * Feature - Multiple downloadable files per product/variation (kudos Justin Stern). * Feature - Download expiry for variations (kudos niravmehta). * Feature - Added wildcard support to local delivery postcodes.