I currently have several dropdown menus that calculate a total price at the end. While it's working well, I am facing a few challenges.
Firstly, I want to incorporate additional prices into the calculation. The breakdown should be as follows:
Total: £20.97
V.A.T: £4.19
Total Amount: £25.16
I believe this is a simple task but I can't figure out how to do it?
Secondly - The calculation only works with single selection drop down lists. If I try to select multiple options in one list, it only calculates one.
Here is the code I am using for the price calculation:
$(function(){
$(".calculate").on("change", function(){
var total = 0;
$('.calculate').each(function() {
if($(this).val() != 0) {
total += parseFloat($(this).val());
}
});
$('#total').text('£' + total.toFixed(2));
});
});//]]>
Thirdly, I have around 8 dropdown lists. However, I want the last one to offer a discount on the total price instead of adding to it. The code mentioned above takes the price from option value of each selection, including the discount amount (listed as 10% in the discount column of the database).
Essentially, after selecting from the first 7 lists and getting a total of, let's say, £20.97, once the last list is selected, the price should be replaced with a discounted amount like (-10%) £18.87.
I am almost done with this project but struggling with this final hurdle.
Thank you