Merge pull request #4555 from claudiosmweb/added_placeholder_for_category_reports

Fixed untranslatable string in reports by category
This commit is contained in:
Mike Jolley 2014-01-21 15:39:06 -08:00
commit 8f11a4440d
1 changed files with 37 additions and 34 deletions

View File

@ -10,19 +10,21 @@ 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'] ) );
}
}
/**
* Get the legend for the main chart sidebar
* @return array
*/
public function get_chart_legend() {
if ( ! $this->show_categories )
if ( ! $this->show_categories ) {
return array();
}
$legend = array();
$index = 0;
@ -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 );
@ -150,7 +153,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
?>
<form method="GET">
<div>
<select multiple="multiple" class="chosen_select" id="show_categories" name="show_categories[]" style="width: 205px;">
<select multiple="multiple" data-placeholder="<?php _e( 'Select categories&hellip;', 'woocommerce' ); ?>" class="chosen_select" id="show_categories" name="show_categories[]" style="width: 205px;">
<?php
$r = array();
$r['pad_counts'] = 1;
@ -338,7 +341,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
tickColor: 'transparent',
mode: "time",
timeformat: "<?php if ( $this->chart_groupby == 'day' ) echo '%d %b'; else echo '%b'; ?>",
monthNames: <?php echo json_encode( array_values( $wp_locale->month_abbrev ) ) ?>,
monthNames: <?php echo json_encode( array_values( $wp_locale->month_abbrev ) ); ?>,
tickLength: 1,
minTickSize: [1, "<?php echo $this->chart_groupby; ?>"],
tickSize: [1, "<?php echo $this->chart_groupby; ?>"],