From a7d7b6b6a6035c58fcf6e64e4e367eed558ff205 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Sun, 12 Aug 2012 09:28:07 +0100 Subject: [PATCH] Fix - Notice in invoice template with number_format --- classes/class-wc-order.php | 22 +++++++++++----------- readme.txt | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/classes/class-wc-order.php b/classes/class-wc-order.php index cf4a556523c..fac83768b88 100644 --- a/classes/class-wc-order.php +++ b/classes/class-wc-order.php @@ -260,21 +260,21 @@ class WC_Order { /** Gets shipping and product tax */ function get_total_tax() { - return apply_filters( 'woocommerce_order_amount_total_tax', number_format( $this->order_tax + $this->order_shipping_tax, 2, '.', '' ) ); + return apply_filters( 'woocommerce_order_amount_total_tax', number_format( (double) $this->order_tax + (double) $this->order_shipping_tax, 2, '.', '' ) ); } /** * gets the total (product) discount amount - these are applied before tax */ function get_cart_discount() { - return apply_filters( 'woocommerce_order_amount_cart_discount', number_format( $this->cart_discount, 2, '.', '' ) ); + return apply_filters( 'woocommerce_order_amount_cart_discount', number_format( (double) $this->cart_discount, 2, '.', '' ) ); } /** * gets the total (product) discount amount - these are applied before tax */ function get_order_discount() { - return apply_filters( 'woocommerce_order_amount_order_discount', number_format( $this->order_discount, 2, '.', '' ) ); + return apply_filters( 'woocommerce_order_amount_order_discount', number_format( (double) $this->order_discount, 2, '.', '' ) ); } /** @@ -282,18 +282,23 @@ class WC_Order { */ function get_total_discount() { if ($this->order_discount || $this->cart_discount) : - return apply_filters( 'woocommerce_order_amount_total_discount', number_format( $this->order_discount + $this->cart_discount, 2, '.', '' ) ); + return apply_filters( 'woocommerce_order_amount_total_discount', number_format( (double) $this->order_discount + (double) $this->cart_discount, 2, '.', '' ) ); endif; } /** Gets shipping */ function get_shipping() { - return apply_filters( 'woocommerce_order_amount_shipping', number_format( $this->order_shipping, 2, '.', '' ) ); + return apply_filters( 'woocommerce_order_amount_shipping', number_format( (double) $this->order_shipping, 2, '.', '' ) ); } /** Gets shipping tax amount */ function get_shipping_tax() { - return apply_filters( 'woocommerce_order_amount_shipping_tax', number_format( $this->order_shipping_tax, 2, '.', '' ) ); + return apply_filters( 'woocommerce_order_amount_shipping_tax', number_format( (double) $this->order_shipping_tax, 2, '.', '' ) ); + } + + /** Gets order total */ + function get_total() { + return apply_filters( 'woocommerce_order_amount_total', number_format( (double) $this->order_total, 2, '.', '' ) ); } /** Gets shipping method title */ @@ -301,11 +306,6 @@ class WC_Order { return apply_filters( 'woocommerce_order_shipping_method', ucwords( $this->shipping_method_title ) ); } - /** Gets order total */ - function get_total() { - return apply_filters( 'woocommerce_order_amount_total', number_format( $this->order_total, 2, '.', '' ) ); - } - /** Get item subtotal - this is the cost before discount */ function get_item_subtotal( $item, $inc_tax = false, $round = true ) { if ($inc_tax) : diff --git a/readme.txt b/readme.txt index 74e1f0d34d8..434a8cc924b 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.6.4 = * Fix - Missing grouped product cart buttons +* Fix - Notice in invoice template with number_format = 1.6.3 - 10/08/2012 = * Feature - Option to register using the email address as the username instead of entering a username