Announcement

Collapse
No announcement yet.

Multi-item purchase-price esimator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multi-item purchase-price esimator

    If I create a BV page offering multiple items for sale, is it possible to somehow get PayPal-style "Add to Cart" and "View Cart" functionality on that page, just for order-estimating purposes, without actually sending the user to PayPal?

    I want my visitors to be able to calculate (only, NOT pay) the approximate cost to have me process multiple reels of film for them. I don't want them to have to jump back and forth between this BV page and PayPal in order to estimate the cost.

    Example: A customer might have three 50-foot reels, one 30-foot reel, and two 20-foot reels. Each size reel has a fixed cost for processing.

    For each size reel, there would be a dropdown menu that the visitor would click to specify the # of reels he has to process. Based on the # chosen from this dropdown, the cost would automatically be calculated and shown in a separate field on the page. This "running total" would increase automatically as the visitor selects quantities for additional sizes of reels.

    I've searched DynamicDrive and other sites for a script that could help me do this, but (no surprise) haven't found one. Now that I re-read the above, I guess this is more complicated than I first thought. But if anyone can suggest how to do it, I would appreciate it very much! Thanks.

  • #2
    Re: Multi-item purchase-price esimator

    It's a bit of an unusual request, I know . . . but would love to hear from someone on it. Navaldesign maybe?

    Comment


    • #3
      Re: Multi-item purchase-price esimator

      If you want a shopping cart like functionality then you need to write the code for one or use an existing shopping cart program.

      If you only have a small number of products one option is to use javascript to compute an estimate. Based on your description I'm guessing this is the case. You indicate that there will be a drop down to change the quantity for each reel. You can take advantage of the onChange event listener and write a simple total calculator like below:

      Code:
      <html>
      <head>
      <script type="text/javascript">
      function updateTotal()
      {
      total = 0;
      cost = new Array(10,7,5);
      
      var x=document.getElementById("cart");
      for (var i=0;i<x.length-1;i++)
        {
          itemCost = parseInt(x.elements[i].value) * cost[i];
      
          total = total + itemCost;
        }
      cart.total.value = total;
      }
      </script>
      </head>
      <body>
      
      <form id="cart" action="">
      50 ft reels: <select id=1 name="qty50ft" onChange=updateTotal();>
      <option value="0">Select Qty</option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      </select>
      <br>
      30 ft reels: <select id=2 name="qty30ft" onChange=updateTotal();>
      <option value="0">Select Qty</option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      </select>
      <br>
      20 ft reels: <select id=3 name="qty20ft" onChange=updateTotal();>
      <option value="0">Select Qty</option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      </select>
      <br>
      <br>
      Total: <input name="total" value=0 readonly=readonly>
      </form>
      
      </body>
      </html>
      Basically what this does is use an array to store the cost for each reel and loops through the 3 different sizes to compute the total. The total field is set to read only so it is not editable by the user. Not sure if this is what you are looking for but it's one way to do what you are asking.
      Mattski

      http://www.ScorpioFire.com


      Comment


      • #4
        Re: Multi-item purchase-price esimator

        Naval Design would definately be your man

        Click here to see a website I worked on which needed a 'quote me' facility.

        Naval Design is not expensive and will give the you the result you are looking for. You can contact him directly here
        Happy Building

        DarrenC

        Comment


        • #5
          Re: Multi-item purchase-price esimator

          Originally posted by jimchicago View Post
          If I create a BV page offering multiple items for sale, is it possible to somehow get PayPal-style "Add to Cart" and "View Cart" functionality on that page, just for order-estimating purposes, without actually sending the user to PayPal?
          Definately yes. A shopping cart like script without final checkout.
          You can either use one of the ready ones, and select no checkout at all, OR as Mattski suggested, if you only have a few "products" a Javascript embedded in a "catalog" like page.
          Navaldesign
          Logger Lite: Low Cost, Customizable, multifeatured Login script
          Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
          DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
          Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

          Comment


          • #6
            Re: Multi-item purchase-price esimator

            Thank you, I very much appreciate hearing from all three of you. I put Mattski's javascript on a BV page, previewed it, and it seems to work perfectly.

            Mattski, I assume you set the prices at $10 for a 50-foot reel, $7 for a 30-foot, and $5 for a 20-foot. I see I can change those prices by editing the numbers in this line of the code:
            cost = new Array(10,7,5)

            But I tried changing 10 to 10.25 to see if the "Total" would be calculated to the penny, and it wasn't. Whatever quantity I select, the "Total" is rounded to the nearest dollar. Any trick to making it calculate the total to the hundredths place?

            Also, two other nice-to-haves:
            1) How can I increase the (empty) vertical space between the bottom of one drop-down menu frame and the top of the text just below that frame?

            2) How can I make a dollar sign appear to the left of whatever number is generated in the "Total" box?

            Again, THANK YOU very much for your help (especially Mattski, very kind of you to provide this code)!

            Comment


            • #7
              Re: Multi-item purchase-price esimator

              Disregard my question about how to get it to calculate the total to the hundredth. I hadn't changed 10 to 10.25 in the "newArray" line of code. Once I did, it worked fine.

              Comment


              • #8
                Re: Multi-item purchase-price esimator

                Glad you were able to figure out the pricing. I probably should have added some comments to make it easier to figure out.

                1) To add more vertical space add another
                Code:
                <br>
                there is currently one in between each drop down so add one or more depending on how much space you want.

                2)You have a couple options for the "$":
                a) Treat the total like a string and append the "$" on the front.
                Code:
                cart.total.value = "$" +total
                b) Add the "$" to the text after the word "Total"
                Code:
                Total: $<input name="total" value=0 readonly=readonly>
                Mattski

                http://www.ScorpioFire.com


                Comment


                • #9
                  Re: Multi-item purchase-price esimator

                  Great, thanks for those answers, I will use them. Hope to talk with you (all) again soon on another thread here in Voda-land.

                  Comment

                  Working...
                  X