Merge pull request #4555 from claudiosmweb/added_placeholder_for_category_reports
Fixed untranslatable string in reports by category
This commit is contained in:
commit
8f11a4440d
|
@ -10,24 +10,26 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
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'] );
|
$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'] ) );
|
$this->show_categories = array( absint( $_GET['show_categories'] ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the legend for the main chart sidebar
|
* Get the legend for the main chart sidebar
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_chart_legend() {
|
public function get_chart_legend() {
|
||||||
if ( ! $this->show_categories )
|
if ( ! $this->show_categories ) {
|
||||||
return array();
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
$legend = array();
|
$legend = array();
|
||||||
$index = 0;
|
$index = 0;
|
||||||
|
|
||||||
foreach( $this->show_categories as $category ) {
|
foreach ( $this->show_categories as $category ) {
|
||||||
$category = get_term( $category, 'product_cat' );
|
$category = get_term( $category, 'product_cat' );
|
||||||
$term_ids = get_term_children( $category->term_id, 'product_cat' );
|
$term_ids = get_term_children( $category->term_id, 'product_cat' );
|
||||||
$term_ids[] = $category->term_id;
|
$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';
|
$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';
|
$current_range = '7day';
|
||||||
|
}
|
||||||
|
|
||||||
$this->calculate_current_range( $current_range );
|
$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' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,7 +153,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
|
||||||
?>
|
?>
|
||||||
<form method="GET">
|
<form method="GET">
|
||||||
<div>
|
<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…', 'woocommerce' ); ?>" class="chosen_select" id="show_categories" name="show_categories[]" style="width: 205px;">
|
||||||
<?php
|
<?php
|
||||||
$r = array();
|
$r = array();
|
||||||
$r['pad_counts'] = 1;
|
$r['pad_counts'] = 1;
|
||||||
|
@ -338,7 +341,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
|
||||||
tickColor: 'transparent',
|
tickColor: 'transparent',
|
||||||
mode: "time",
|
mode: "time",
|
||||||
timeformat: "<?php if ( $this->chart_groupby == 'day' ) echo '%d %b'; else echo '%b'; ?>",
|
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,
|
tickLength: 1,
|
||||||
minTickSize: [1, "<?php echo $this->chart_groupby; ?>"],
|
minTickSize: [1, "<?php echo $this->chart_groupby; ?>"],
|
||||||
tickSize: [1, "<?php echo $this->chart_groupby; ?>"],
|
tickSize: [1, "<?php echo $this->chart_groupby; ?>"],
|
||||||
|
|
Loading…
Reference in New Issue