Fix JS calc totals Closes #2525.

This commit is contained in:
Mike Jolley 2013-02-25 11:39:15 +00:00
parent b7dd49d73c
commit 625b1cf72e
2 changed files with 11 additions and 23 deletions

View File

@ -394,35 +394,26 @@ jQuery( function($){
var line_totals = 0;
var cart_discount = 0;
var cart_tax = 0;
var order_shipping = $('#_order_shipping').val();
var order_shipping_tax = $('#_order_shipping_tax').val();
var order_discount = $('#_order_discount').val();
var order_shipping = $('#_order_shipping').val() || '0';
var order_shipping_tax = $('#_order_shipping_tax').val() || '0';
var order_discount = $('#_order_discount').val() || '0';
order_shipping = accounting.unformat( order_shipping.replace(',', '.') );
order_shipping_tax = accounting.unformat( order_shipping_tax.replace(',', '.') );
order_discount = accounting.unformat( order_discount.replace(',', '.') );
if ( ! order_shipping ) order_shipping = 0;
if ( ! order_shipping_tax ) order_shipping_tax = 0;
if ( ! order_discount ) order_discount = 0;
$('#order_items_list tr.item').each(function(){
var line_subtotal = $(this).find('input.line_subtotal').val();
var line_subtotal_tax = $(this).find('input.line_subtotal_tax').val();
var line_total = $(this).find('input.line_total').val();
var line_tax = $(this).find('input.line_tax').val();
var line_subtotal = $(this).find('input.line_subtotal').val() || '0';
var line_subtotal_tax = $(this).find('input.line_subtotal_tax').val() || '0';
var line_total = $(this).find('input.line_total').val() || '0';
var line_tax = $(this).find('input.line_tax').val() || '0';
line_subtotal = accounting.unformat( line_subtotal.replace(',', '.') );
line_subtotal_tax = accounting.unformat( line_subtotal_tax.replace(',', '.') );
line_total = accounting.unformat( line_total.replace(',', '.') );
line_tax = accounting.unformat( line_tax.replace(',', '.') );
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 = line_subtotals + line_subtotal;
line_subtotal_taxes = line_subtotal_taxes + line_subtotal_tax;
line_totals = line_totals + line_total;
@ -445,15 +436,12 @@ jQuery( function($){
cart_discount = accounting.toFixed( cart_discount, 2 );
$('#order_items_list tr.fee').each(function(){
var line_total = $(this).find('input.line_total').val();
var line_tax = $(this).find('input.line_tax').val();
var line_total = $(this).find('input.line_total').val() || '0';;
var line_tax = $(this).find('input.line_tax').val() || '0';;
line_total = accounting.unformat( line_total.replace(',', '.') );
line_tax = accounting.unformat( line_tax.replace(',', '.') );
if ( ! line_total ) line_total = 0;
if ( ! line_tax ) line_tax = 0;
line_totals = line_totals + line_total;
if ( woocommerce_writepanel_params.round_at_subtotal=='no' ) {

File diff suppressed because one or more lines are too long