1

I'm not too sure what's the technical name for this, but I'll call it live quotation.

I've this website as example: http://www.ansonika.com/removals/quotation.html

What i need to have is something like, when the costumer fill that form, I need to give him a live quote considering distances/furniture etc...

Here : http://www.fastremoval.com/ They use this live quote but they just ask you for address and they give you an estimate price.

In my case would be something like this but with more options like: how many sofas, how many beds etc.. and for prices we can use fake ones like 1 sofa = 10£, same for distances.

If someone could help me out with this, really appreciate.

1 Answers1

0

You can sum up all the input field values and print them to the customer, for example:

$(document).ready(function() {
    $('input').on('change',function() {
        $('.section').each(function(){
          var totalPoints = 0;
          $(this).find('input').each(function(){
            totalPoints += parseInt($(this).val()); //<==== a catch  in here !! read below
          });
          $('.amount').val(totalPoints);
        });
    });
});
input {
    display: block;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section class="section">
<input type="number" name="number1" value="1" min="1" max="10" step="1">
<input type="number" name="number1" value="1" min="1" max="10" step="1">
<input type="number" name="number1" value="1" min="1" max="10" step="1">
<input type="number" name="number1" value="1" min="1" max="10" step="1">
</section>
<p class="summary">Your total is: <input type="text" class="amount"></p>
odedta
  • 2,430
  • 4
  • 24
  • 51
  • Thank you for your help. now the only thing would be, get the price from the google api + the inputs values. thanks for your help once again – Tiago Sousa Jun 24 '15 at 09:59
  • Google API as in? well, you could ask google: "How to get values from google api xxxxxx" Where xxxxxx is your framework or the plugin you're working with. – odedta Jun 24 '15 at 10:07
  • odedta, I explain above that I need to calculate costs distances + furniture, so if you read well my comment, I'm saying basically that for distances I would need google maps api to calculate distances, and after to get the value I make the math to calculate the distance + the furniture – Tiago Sousa Jun 24 '15 at 10:54
  • I assume that for furniture, every unit has a price so just get the amount from that input field like I showed you in the example. As for the shipping calculations, you'd need to create a formula or hook some post office API if there is any, if not just use Google API like you said, here's a link that explains how: http://stackoverflow.com/questions/2296087/using-php-and-google-maps-api-to-work-out-distance-between-2-post-codes-uk - In the end, sum everything up, again, using jQuery. – odedta Jun 24 '15 at 11:37