I am creating a form to order custom screen printed shirts. I have everything working on the form as far as selecting a shirt, the size and price, but I am lost in figuring out how to total the price. I need each row totaled across as well as an order total for the "Total" column at the bottom. I have attached a quick Photoshop representation of what I am trying to accomplish.
How do I go about doing this?
How do I go about doing this?
Sorry, it didn't attach to the original post.
[attachment=0]sample.jpg[/attachment]
[attachment=0]sample.jpg[/attachment]
Hi tjhaas,
Here's the chunk of code I used in a similar form - a bit more complicated that yours:
Bob
Here's the chunk of code I used in a similar form - a bit more complicated that yours:
/** Calculate the total order price and discounts */
function calculateTotals() {
var total_price, shirts, polos, non_polos, discount;
total_price = 0;
shirts = 0;
polos = 0;
jQ.each(garments, function(garment, data) {
total_price += data.price;
if ( data.style != '' ) {
shirts += 1;
}
});
discount = 0;
if ( shirts > 5 ) {
discount += shirts * 4;
} else if ( shirts > 2 ) {
discount += shirts * 2;
}
price_text = '£'+total_price.toFixed(2);
if ( discount > 0 ) {
price_text += ' less quantity discount of £'+discount.toFixed(2)+' : £'+(total_price - discount).toFixed(2);
}
jQ('#total_price').text(price_text);
}
Bob
This topic is locked and no more replies can be posted.