...

View Full Version : A Simple Order form or Calculation Fields



Palehorse
08-06-2008, 11:11 PM
I hope this is the right forum to post this, if not I apologize and please direct me on where to post this in the future. I have searched for weeks now for a simple order form code that I might (in my limited capacity) manipulate to fit my needs. No luck. To keep this to the point, here is what I'm looking for.

checkbox (activates the row) | quantity x price (price is hidden field)= subtotal

the above has to fit into a table with other elements and duplicated anywhere from 15 to 22 times, depending on the page I use it in.

I was hoping that at the bottom of the page, I could tally all the subtotals into a page total and have it submitted to someplace like PayPal for the final processing of the order.

Am I asking to much on this? I have just a rudimentary understanding of the coding for the script here, and I'm sure I can figure this out if I had some help and nudges in the right direction. I have also found a few scripts that would work, however, I don't know exactly what to take out and put in "where" in order to make them do what I want. Other than going back to school and spending a fortune on scripting classes, can someone help me with this?

ninnypants
08-06-2008, 11:20 PM
This code works and it should get you started in the right direction


//array of item prices
var pricing = new Array();
// number of items
var count = 0;
function priced(t){
var result = count*pricing[lh];
// total amount pluss 5.99 for shipping
var total = Math.round((result+5.99)*100)/100; // returns price
total = total.toString();
str_arr = total.split('.');
if(!str_arr[1]){
total+= ".00";
}else{
switch(str_arr[1].length){
case 1:
total += "0";
break;
case 2:
break;
}
}

Palehorse
08-11-2008, 11:47 PM
This code works and it should get you started in the right direction


//array of item prices
var pricing = new Array();
// number of items
var count = 0;
function priced(t){
var result = count*pricing[lh];
// total amount pluss 5.99 for shipping
var total = Math.round((result+5.99)*100)/100; // returns price
total = total.toString();
str_arr = total.split('.');
if(!str_arr[1]){
total+= ".00";
}else{
switch(str_arr[1].length){
case 1:
total += "0";
break;
case 2:
break;
}
}

Thank you, I'll be giving this a shot and see how far I get in understanding it. Sorry to be such a dweeb, I draw pretty pictures (Graphic Artist), not much of a head for code I'm afraid. lol. But thank you, thank you, thank you!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum