function recalculateValues(idObject, idProductQuantity = null) { var _price = getIntValue($("#priceProduct_" + idObject).html()); var _quantity = $("#quantity_" + idObject).val(); var _discount = getIntValue($("#discount_" + idObject).html()); var _total = (_price - _discount) * _quantity; $("#totalProduct_" + idObject).html(currencyFormat(_total)); var objectType = String(idObject).charAt(0); updateCart(idObject, _quantity, objectType, idProductQuantity); recalculateTotal(); } function recalculateTotal() { var _total = 0; $(".totalProductValue").each(function () { _total += getIntValue($(this).html()); }); $("#totalPrice").html(currencyFormat(_total)); } function removeObjectFromView(idObject, objectType, idProductQuantity) { console.log("#trProduct_" + objectType + '' + idObject); var removeObjectFunction = function () { $("#trProduct_" + objectType + '' + idObject).remove(); }; return removeObject( idObject, objectType, idProductQuantity, removeObjectFunction ); }