Estou usando essa função, mais não calcula os centavos exemplo: 24,50 + 12,00 = 36,00 E os valores exemplo 1.230,00 fica assim 1230.00 O que pode estar ocorrendo para não calculo dos centavos, e regra para deixar ponto e virgula. AONDE PARECE O VALOR <?php echo SUB_TITLE_SUB_TOTAL; ?></b><span id="total_display"><?php echo $currencies->format($cart->show_total()); ?></span><input type="hidden" id="sub_total" value="<?php echo $cart->total; ?>" />
FUNÇÃO
<script type="text/javascript">
var xmlhttp;
function loadXMLDoc(url)
{
var postcode = document.getElementById('postcode').value;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=stateChange;
xmlhttp.open("GET",url+"&postcode="+postcode,true);
xmlhttp.send(null);
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=stateChange;
xmlhttp.open("GET",url+"&postcode="+postcode,true);
xmlhttp.send();
}
}
var xmlhttp;
function enviaReq(url, tipo)
{
var postcode = document.getElementById('postcode').value;
var shipping = document.getElementById('shipping_'+tipo).value;
var valor_frete = document.getElementById('valor_'+tipo).value;
var sub_total = document.getElementById('sub_total').value;
var total = (parseFloat(valor_frete) + parseFloat(sub_total)).toFixed(2);
document.getElementById("total_display").innerHTML= "+total;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=stateChange;
xmlhttp.open("GET",url+"&postcode="+postcode+"&shipping="+shipping,true);
xmlhttp.send(null);
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=stateChange;
xmlhttp.open("GET",url+"&postcode="+postcode+"&shipping="+shipping,true);
xmlhttp.send();
}
}
function stateChange()
{
if (xmlhttp.readyState==4)
{
if (xmlhttp.status==200)
{
// process whatever has been sent back here
document.getElementById('test').innerHTML=xmlhttp.responseText;
}
}
}
</script>