# Adding custom % rate to dynamic total

Asked on July 31, 2011 at 03:25 PM

Hey there, I'm trying to come up with a way to include an equation that would add a 25% increase to my order forms grand total if the sub total is greater than \$90.

So far this is the code I came up with :(but its not working)

/**
* Calculates the payment total with quantites
* @param {Object} prices
*/

countTotal: function(prices){

var
total 0;

\$H(prices).each(function(pair){

total parseFloat(total);
var
price parseFloat(pair.value.price);
if (\$(
pair.key).checked) {
if (\$(
pair.value.quantityField)) {

price price parseInt(\$(pair.value.quantityField).getSelected().text10);
}

total += price;
}
});

if (
total === 0) {

total "0.00";
}
else if (
total 90){

total += (total .25);
}
if (\$(
"payment_total")) {
\$(
"payment_total").update(parseFloat(total).toFixed(2));
}
},

/**
* Sets the events for dynamic total calculation
* @param {Object} prices
*/

totalCounter: function(prices){

\$H(prices).each(function(pair){
\$(
pair.key).observe('click', function(){

JotForm.countTotal(prices);
});
if (\$(
pair.value.quantityField)) {
\$(
pair.value.quantityField).observe('change', function(){
\$(
pair.key).checked true;

JotForm.countTotal(prices);
});
}
});
},

• mliz
Answered on August 02, 2011 at 02:03 AM