E-commerceapplication for pricing by area

  geoff47 20:55 PM 30 Aug 10
Locked

I wonder if it possible to have an application to price a commodity by area ?
My idea would be the customer puts in two dimensions and it results in a price based on a price per square metre.
I could give fixed prices for fixed sizes, but would like another option so customers can choose exactly what size they buy.

Hope it's not a tall order.
Any suggestions would be very welcome.
Thanks in advance

  Ansolan 22:13 PM 30 Aug 10

Have the code below lying around if that helps. A bit basic but gives you a start. Doubtless mentioning what you already know but in case, save the code in notepad, change the extension to .html and have a look, see if you think this is worth incorporating into your page. You would only need to change the value (currently 300) and add a little styling to suit.

<html>
<head>
<title>Calculator</title>
<script type="text/javascript">
//calculator
function cal() {
var x=document.form.length.value
var y=document.form.width.value
var a=x*y //calculates square meters
var total=a*300 //calculates cost. Enter your own cost/sq. meter
document.form.total.value=total;
}
</script>
</head>
<body>

<h3>Project cost calculator:</h3>
<form action="" name="form">
<p><input type="text" name="length" size="2" /> Enter the length of your project in meters.<br />
<input type="text" name="width" size="2" /> Enter the width of your project in meters.</p>

<p><b>Click this button to calculate the approximate cost of your project:</b><br />
<input type="button" name="money" value="calculate" onclick="cal()" /></p>

<p>£ <input type="text" name="total" size="6" /></p>
</form>
</body>
</html>

  geoff47 23:21 PM 30 Aug 10

Thank you for that, I shall give it a go.
I know next to nothing about code, but have been surprising myself lately.
Done things I thought were beyond me.
Thanks I shall let you know how I get on.
Don't hold your breathe.....this may take a while.

  geoff47 23:31 PM 30 Aug 10

I cannot thank you enough.
Hopefully I can tweak it about a bit to do exactly what I want.
Linking it to a shopping cart.
Many thanks indeed

Advertisement

This thread is now locked and can not be replied to.

Sony Xperia Z5 review: Hands-on with the phone which the Z3+ should have been

1995-2015: How technology has changed the world in 20 years

How to choose a photographer

iPhone 6S preview: What to expect from Apple's next iPhone