Merge pull request #6324 from SiR-DanieL/reports-currency

Fixing currency position in reports
This commit is contained in:
Mike Jolley 2014-10-09 12:39:20 +01:00
commit 728086d175
5 changed files with 26 additions and 6 deletions

View File

@ -514,6 +514,26 @@ class WC_Admin_Report {
}
}
/**
* Return currency tooltip JS based on WooCommerce currency position settings.
*
* @return string
*/
public function get_currency_tooltip() {
switch( get_option( 'woocommerce_currency_pos' ) ) {
case 'left':
$currency_tooltip = 'prepend_tooltip: "' . get_woocommerce_currency_symbol() . '"'; break;
case 'left_space':
$currency_tooltip = 'prepend_tooltip: "' . get_woocommerce_currency_symbol() . ' "'; break;
case 'right':
$currency_tooltip = 'append_tooltip: "' . get_woocommerce_currency_symbol() . '"'; break;
case 'right_space':
$currency_tooltip = 'append_tooltip: " ' . get_woocommerce_currency_symbol() . '"'; break;
}
return $currency_tooltip;
}
/**
* Get the main chart
*

View File

@ -434,7 +434,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
points: { show: true, radius: 5, lineWidth: 3, fillColor: '#fff', fill: true },
lines: { show: true, lineWidth: 4, fill: false },
shadowSize: 0,
prepend_tooltip: "<?php echo get_woocommerce_currency_symbol(); ?>"
<?php echo $this->get_currency_tooltip(); ?>
}
];

View File

@ -330,7 +330,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
data: jQuery.parseJSON( "' . json_encode( $series ) . '" ),
color: "' . $color . '",
bars: { fillColor: "' . $color . '", fill: true, show: true, lineWidth: 1, align: "center", barWidth: ' . $width * 0.75 . ', stack: false },
prepend_tooltip: "' . get_woocommerce_currency_symbol() . '",
' . $this->get_currency_tooltip() . '",
enable_tooltip: true,
prepend_label: true
},';

View File

@ -397,7 +397,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
points: { show: true, radius: 5, lineWidth: 3, fillColor: '#fff', fill: true },
lines: { show: true, lineWidth: 4, fill: false },
shadowSize: 0,
prepend_tooltip: "<?php echo get_woocommerce_currency_symbol(); ?>"
<?php echo $this->get_currency_tooltip(); ?>
},
{
label: "<?php echo esc_js( __( 'Refund amount', 'woocommerce' ) ) ?>",
@ -417,7 +417,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
points: { show: true, radius: 5, lineWidth: 3, fillColor: '#fff', fill: true },
lines: { show: true, lineWidth: 4, fill: false },
shadowSize: 0,
prepend_tooltip: "<?php echo get_woocommerce_currency_symbol(); ?>"
<?php echo $this->get_currency_tooltip(); ?>
},
{
label: "<?php echo esc_js( __( 'Sales amount', 'woocommerce' ) ) ?>",
@ -427,7 +427,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
points: { show: true, radius: 5, lineWidth: 3, fillColor: '#fff', fill: true },
lines: { show: true, lineWidth: 4, fill: false },
shadowSize: 0,
prepend_tooltip: "<?php echo get_woocommerce_currency_symbol(); ?>"
<?php echo $this->get_currency_tooltip(); ?>
}
];

View File

@ -458,7 +458,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
points: { show: true, radius: 5, lineWidth: 3, fillColor: '#fff', fill: true },
lines: { show: true, lineWidth: 4, fill: false },
shadowSize: 0,
prepend_tooltip: "<?php echo get_woocommerce_currency_symbol(); ?>"
<?php echo $this->get_currency_tooltip(); ?>
}
];