We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

The Field with SUM total inside ?

How Do I?

Dom's avatar
Dom
88 posts
9 years ago
Dom's avatar Dom

Hello Everyone 😊

I’m creating a Estimate Form like below and i wonder know if you know how to make Last Field (…SUM…) to display the Total SUM of all Prices ?

The idea i want looks like this : http://www.hippodrom.de/fruehlingsfest/#reservieren (at below of this page you can see the dynamic SUM displays the total of prices selected and chosen).

My example Estimate Form below :

My template code content :

{exp:channel:entries channel="list_product" limit="1" author_id="CURRENT_USER"}
<div  left; width: 260px;">
<form action="action_page.php">
Select Product 1 : {product_1_100} or {product_1_150}


Select Product 2 : {product_2_200} or {product_2_250}


Select Product 3 : {product_3_300} or {product_3_350}


Total Price : ...SUM...


<input type="submit" value="Submit">
</form>
</div>
{/exp:channel:entries}

My template looks :

Select Product 1 : [  ] 100€ or [  ] 150€ >>> I chose here : 100€
Select Product 2 : [  ] 200€ or [  ] 250€ >>> I chose here : 200€
Select Product 3 : [  ] 300€ or [  ] 350€ >>> I chose here : 300€
Total Price : ...SUM... >>> It has to change automaticly to 600€
Submit Button

PS : When i click the “Submit” button, the form-data will be sent to a page called “action_page.php” or to “EE Edit Channel Entries” where i can see the Estimate data stored.

So now, i’m still looking the Script or Code in order to display the …SUM… automaticly on the online template to 600€ ?

Please let me know if you know some Addons like this at Devot-ee or perhaps a Developper who can make it ?

Regards.

       
Ingo Wedler's avatar
Ingo Wedler
63 posts
9 years ago
Ingo Wedler's avatar Ingo Wedler

Something like this? Requires jQuery…

note: “Removed” in the code means open and closed script tag… And behind the class=”price” are “onchange=”sum(‘price’);”” removed

[removed]
function sum(price) { 
    $("."+price+"sum").val(0);
    var sum = 0;
    $("."+price).each(function() {
        if(!isNaN(this.value) && this.value.length!=0) {
            sum += parseFloat(this.value);
        }
    });
    $("."+price+"sum").val(sum);
    update(id);
} 
[removed]

<form method="post" action="#">
Apples: <select name="Apples" class="price" >
    <option>Your Choice</option>
    <option>100</option>
    <option>200</option> 
</select>

Apples: <select name="Apples1" class="price" >
    <option>Your Choice</option>
    <option>100</option>
    <option>200</option> 
</select>

Apples: <select name="Apples2" class="price" >
    <option>Your Choice</option>
    <option>100</option>
    <option>200</option> 
</select>

Summary: <input type="text" class="pricesum" />
</form>
       
Ingo Wedler's avatar
Ingo Wedler
63 posts
9 years ago
Ingo Wedler's avatar Ingo Wedler

Demo: http://ingowedler.com/price.html

       
Dom's avatar
Dom
88 posts
9 years ago
Dom's avatar Dom

Hi Ingo,

Yes the JQuery will be good too, wow that’s i’m looking for :D Is it your mail Ingo : [email protected] ?

I’m in a project now, and next week if my project is confirmed, i’ll contact you for asking more like this and i hope you have Paypal 😊

Thank you for that JQuery !

Regards.

       
Ingo Wedler's avatar
Ingo Wedler
63 posts
9 years ago
Ingo Wedler's avatar Ingo Wedler

Yes, it’s one of my mail adresses. Feel free to contact me. If i have time and can help, why not help…

       
Dom's avatar
Dom
88 posts
9 years ago
Dom's avatar Dom

Ok Ingo,

I added you to my contact list, and will let you know next week for this project, if this project is confirmed, you must help me and i’ll paypal you for sure 😊

Regards.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.