2014-08-28 15:21:05 +02:00
|
|
|
function update_price($this){
|
|
|
|
|
var id = $this.data('id');
|
|
|
|
|
|
|
|
|
|
// Calculate price for row
|
|
|
|
|
var value = $this.val();
|
|
|
|
|
var price = $('#price_' + id).text();
|
2017-09-20 21:38:34 +05:30
|
|
|
$('#total_row_' + id).text((value * price).toFixed(2));
|
2014-08-28 15:21:05 +02:00
|
|
|
|
|
|
|
|
// Calculate total price
|
|
|
|
|
var total = 0;
|
|
|
|
|
$('.total_row').each(function( index ) {
|
2017-09-18 19:07:13 +05:30
|
|
|
total += parseFloat($(this).text());
|
2014-08-28 15:21:05 +02:00
|
|
|
});
|
2017-09-25 00:34:53 +05:30
|
|
|
$('#total_price').text(total.toFixed(2));
|
2014-08-28 15:21:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$( document ).ready(function() {
|
|
|
|
|
$('.quantity').each(function() {
|
|
|
|
|
update_price($(this));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.quantity').change(function() {
|
|
|
|
|
update_price($(this));
|
|
|
|
|
});
|
2016-03-18 00:25:15 +05:30
|
|
|
$(function () {
|
|
|
|
|
$('[data-toggle="tooltip"]').tooltip()
|
|
|
|
|
});
|
2014-08-28 15:21:05 +02:00
|
|
|
});
|