Sorry I did not post all the context before. Please need some help!
Currently this works ok with single rate values
Need modify the following script. Basically I need to convert the 1 rate value to multiple ones. Close to a shipping rate calculator. i.e, if amount is between 1 and 10 you pay $2.00, if between 10 and 20 you pay $3.00 and so on. Here is the actual function who process the information. Everything else works pretty much.
//here are the current options (might need to written differently)
<?php
$ship_options = array (
array ("texas", 0.0800),
array ("phoenix", 0.900)
);
?>
<script type="text/javascript">
function doTotals(form) {
var sub_tot_amt=0, tax_amt=0, g_tot_amt=0, admin_amt=0;
for (var i=0; i < <?php echo $num_products ?>; i++) {
var cur_field = form[ products + "qty" ];
if ( !isPosInt(form, cur_field, cur_field.value) ) return;
else sub_tot_amt += parseFloat(cur_field.value) parseFloat( form[ products + "price" ].value );
}
form.sub_tot.value = formatDecimal(sub_tot_amt, 2);
if ( form.sales_tax && form.sales_tax.checked ) {
tax_amt = <?php echo isset($cur_sales_tax)? $cur_sales_tax: 0 ?> form.grand_tot.value;
form.tax_amt.value = formatDecimal(tax_amt);
}
//start//Here I need to incorporate the values of the table rates and still make this to work.
if (sub_tot_amt==0) g_tot_amt=0;
else g_tot_amt = sub_tot_amt + admin_amt +
<?php echo ( isset($ship_options) && !empty($ship_options) )? 'parseFloat(form.ship_amt.value)': 0 ?>;
form.grand_tot.value = formatDecimal(g_tot_amt);
//stop
if (sub_tot_amt==0) g_tot_amt=0;
else g_tot_amt = tax_amt + g_tot_amt +
<?php echo ( isset($admin_options) && !empty($admin_options) )? 'parseFloat(form.admin_amt.value)': 0 ?>;
form.grand_tot.value = formatDecimal(g_tot_amt);
if (sub_tot_amt==0) g_tot_amt=0;
else g_tot_amt = admin_amt + g_tot_amt +
<?php echo ( isset($corp_options) && !empty($p_options) )? 'parseFloat(form.p_amt.value)': 0 ?>;
form.grand_tot.value = formatDecimal(g_tot_amt);
}
</script>
------------------------------<--------------------------->-----------------------------------------
<?php
// Shipping options?
if ( isset($ship_options) && !empty($ship_options) ) {
$class = ($class == 'even')? 'odd': 'even';
$num_ship_opt = count($ship_options);
echo '<tr class="' . $class . '">
<td>Select a delivery option</td>
<td colspan="2">';
for ($row=0; $row < $num_ship_opt; $row++) {
$cur = $ship_options[$row];
echo '
<input type="radio" name="ship_opt" value="' . $cur[1] . '" tabindex="' . ($num_products + 1) . '"
onclick="inspectOptions(this,this.form.ship_amt,this.form)">' . $cur[0] . '<br>';
}
echo '
</td>
<td class="lbl">$<input class="cur" type="Text" name="ship_amt" size="8" value="0.00" readonly onfocus="this.blur()"></td>
</tr>
';
}
?>
Any help will be appreciated
Thank you