Prevent NaN Closes #1104.

This commit is contained in:
Mike Jolley 2012-06-10 09:08:11 +01:00
parent 91e0ade791
commit 9031d15756
3 changed files with 18 additions and 11 deletions

View File

@ -159,25 +159,30 @@ jQuery( function($){
if (answer) { if (answer) {
// Get row totals // Get row totals
var line_subtotals = 0; var line_subtotals = 0;
var line_subtotal_taxes = 0; var line_subtotal_taxes = 0;
var line_totals = 0; var line_totals = 0;
var cart_discount = 0; var cart_discount = 0;
var cart_tax = 0; var cart_tax = 0;
var order_shipping = parseFloat( $('#_order_shipping').val() ); var order_shipping = parseFloat( $('#_order_shipping').val() );
var order_shipping_tax = parseFloat( $('#_order_shipping_tax').val() ); var order_shipping_tax = parseFloat( $('#_order_shipping_tax').val() );
var order_discount = parseFloat( $('#_order_discount').val() ); var order_discount = parseFloat( $('#_order_discount').val() );
if (!order_shipping) order_shipping = 0; if ( ! order_shipping ) order_shipping = 0;
if (!order_shipping_tax) order_shipping_tax = 0; if ( ! order_shipping_tax ) order_shipping_tax = 0;
if (!order_discount) order_discount = 0; if ( ! order_discount ) order_discount = 0;
$('#order_items_list tr.item').each(function(){ $('#order_items_list tr.item').each(function(){
var line_subtotal = parseFloat( $(this).find('input.line_subtotal').val() ); var line_subtotal = parseFloat( $(this).find('input.line_subtotal').val() );
var line_subtotal_tax = parseFloat( $(this).find('input.line_subtotal_tax').val() ); var line_subtotal_tax = parseFloat( $(this).find('input.line_subtotal_tax').val() );
var line_total = parseFloat( $(this).find('input.line_total').val() ); var line_total = parseFloat( $(this).find('input.line_total').val() );
var line_tax = parseFloat( $(this).find('input.line_tax').val() ); var line_tax = parseFloat( $(this).find('input.line_tax').val() );
if ( ! line_subtotal ) line_subtotal = 0;
if ( ! line_subtotal_tax ) line_subtotal_tax = 0;
if ( ! line_total ) line_total = 0;
if ( ! line_tax ) line_tax = 0;
line_subtotals = parseFloat( line_subtotals + line_subtotal ); line_subtotals = parseFloat( line_subtotals + line_subtotal );
line_subtotal_taxes = parseFloat( line_subtotal_taxes + line_subtotal_tax ); line_subtotal_taxes = parseFloat( line_subtotal_taxes + line_subtotal_tax );

File diff suppressed because one or more lines are too long

View File

@ -168,6 +168,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Tweak - country_multiselect_options returns allowed countries only * Tweak - country_multiselect_options returns allowed countries only
* Tweak - Add order - country should not set itself * Tweak - Add order - country should not set itself
* Tweak - Add error/message filters * Tweak - Add error/message filters
* Tweak - Only allow 1 shipping class in quick edit.
* Fix - Strange error where detecting the page (is_page etc) would break the canonical redirect in some instances when hooked into 'wp'. Used the later get_header hook instead. * Fix - Strange error where detecting the page (is_page etc) would break the canonical redirect in some instances when hooked into 'wp'. Used the later get_header hook instead.
* Fix - Right now links. * Fix - Right now links.
* Fix - fix for https://bugs.php.net/bug.php?id=61166 (thanks Max Rice) * Fix - fix for https://bugs.php.net/bug.php?id=61166 (thanks Max Rice)
@ -180,6 +181,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - Out of base tax rounding * Fix - Out of base tax rounding
* Fix - Backorders for variations allow more than stock to be purchased now * Fix - Backorders for variations allow more than stock to be purchased now
* Fix - Conflict with compfight. * Fix - Conflict with compfight.
* Fix - Tax calc JS NaN fix
* Localization - Updated localisations * Localization - Updated localisations
* Localization - Updated currency symbols * Localization - Updated currency symbols
* Localization - translations for admin menu names * Localization - translations for admin menu names