I wish to use a simple form for clients to submit an order. No need for taking online payments All I need is the form to calculate the totals and submit the form data via email. There will be a total of about 50-60 products.
This page uses the Protaculous action and then some code in the Top Function Body and Bottom Function Body sections. Add the action and then choose Prototype Packed from the selector
Create your form in the usual manner but make sure that you use the extended dialogue to add name: ‘ID’ value: ‘something unique’ to each of your amount selectors.
You will see the two sets of code on the example page. You can copy/paste them (but use a plain text editor).
The top (left) code calculates the totals from the user entered quantity and hard coded values while the bottom (right) code adds all the sub totals to create the grand total.
In this example I have used MT1, MT2 etc. as the unique IDs for each product quantity text field. Similarly I have used the same IDs with Total tacked on to create the extended ID values for each of the sub total form items ie MT1Total, MT2Total etc.
As long as the code in the top function body corresponds to your IDs then the calculation will happen automatically.
The sub total fields also have an additional extended value of Name: class , Value: addme
The grand total box has the ID of order_total added to it in the same way.
Using this class the amount in each sub total field is recognised and the bottom function body code adds them all up and puts the total in the Total box.
Additionally I have added the same unique IDs to the third tab in the inspector Name field. This is also the info that will be sent in the email so it makes sense that your unique IDs easily relate to your products. So in this example MT1 is a Messe-Theke 1
All this code was originally supplied by Walter so he is the man to thank.
Give it a go and let us know how you get on and if you have questions post a page online that we can look at.
I need something similar to total up a column of prices
In my case the item will show the price ie: Messe-Thele 1 £10
I need a check box beside it (not a qty enter box) and I just
need it to total up the selections at the bottom (Total Order) could this be adapted?