Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    A Simple Order form or Calculation Fields

    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?

  • #2
    Regular Coder ninnypants's Avatar
    Join Date
    Apr 2008
    Location
    Utah
    Posts
    504
    Thanks
    10
    Thanked 47 Times in 47 Posts
    This code works and it should get you started in the right direction
    Code:
    //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;
    		}
    	}

  • Users who have thanked ninnypants for this post:

    Palehorse (08-11-2008)

  • #3
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ninnypants View Post
    This code works and it should get you started in the right direction
    Code:
    //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!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •