Good afternoon,
Access this site: conepa.agenciaweblab.com.br/inscricoes Guys, I have a problem, in my cart system, I am getting multiply the value with the amount of each loop, however I am not doing the cart loop with javascript, I am doing with php, and I need to add the values of the subtotals, I would like some solution. Main fields:
<td class="price-col" id="preco_<?= $list_cart->post_id; ?>" data-valor="<?= $list_cart->post_valor; ?>"><?= $list_cart->post_valor; ?></td>
<td class="quantity-col">
<input type="number" onChange="Multiplica(<?= $list_cart->post_id; ?>)" class="form-control qtd_<?= $list_cart->post_id; ?>" <?= $disabled; ?> min="1" max="<?= $list_cart->post_quantidade; ?>" placeholder="0" required="">
and now jquery:
function Multiplica(id) {
var valor = $('#preco_' + id).text();
var quantidade = $('.qtd_' + id).val();
var total = valor * quantidade;
document.getElementById('sub_' + id).innerHTML = number_format(total, '2', ',', '.');
var totals = 0;
$('#preco_' + id).each(function () {
totals += (valor * quantidade);
});
$("#totalSoma").text(totals);
}
Someone to help? I just need the sum total, which I did, did not have much success.