PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Math calculations on confirmation page

  1. gietz
    Member

    Hello! After reading a bunch of posts on here I think my request may be over my head to accomplish it. But this forum rocks and seems like I am at least asking the right people.

    I don't know how to right code...I am trying to learn but not there yet. So if this request is more than I can handle I would appreciate whatever assistance I can get and would be willing to compensate anyones time.

    The variables that I am collecting in the form are: Electric, Gas, Sqf. I am also collecting a lot of other information that will just get emailed to me along with the results that are displayed on the confirmation page.

    Here are the 4 calculations I would like to use.

    (ELECTRIC) + (GAS) X (12) = (ANNUAL_TOTAL)

    (SQF) X (.07) X (12) = (TARGET_USE)

    (ANNUAL_TOTAL) / (TARGET_USE) = (PERCENT_HIGHER)

    (ANNUAL_TOTAL) X (.4) = (SAVING)

    On the Confirmation Page I would like to display:

    Your home is (PERCENT_HIGHER) than similar homes.
    You could save $(SAVING) a year.

    This may not matter or may be obvious but the site is built using wordpress.

    Here is a link to the form. (http://bit.ly/xfhklO). The results page that is currently shown is static...so I am waiting until I can display real results before I link to the form.

    Thanks so much for your help! I can't wait to get this form working!

    Posted 12 years ago on Monday February 6, 2012 | Permalink
  2. Hi gietz,

    The most ideal way to set this up would probably be to create some custom merge tags. I'll do one to show you how it works and you can work out the other. :)

    http://pastie.org/3358537

    Between writing the above paragraph and now, I actually ended up doing both merge tags. Haha, I realized I had already done all the math so I might as well through the other merge tag in there as well. Let's just keep that between us though... can't be doing custom code for every one. ;)

    Just paste that snippet in your theme's functions.php file and replace the field IDs where specified to match the field IDs of your form. Next, in your confirmation message, just paste the new merge tags where you need them: {percent_higher} and {savings}

    Have fun!

    Posted 12 years ago on Saturday February 11, 2012 | Permalink
  3. gietz
    Member

    Oh Wow!!! Umm lots of words of gratitude!!!! Thanks so much. Thank you so much I am going to go and put it work...I may be back for a little more help if I get stuck. Freaking thank you!!!!

    Posted 12 years ago on Monday February 13, 2012 | Permalink
  4. gietz
    Member

    Bummer, I must have done something wrong. :(

    Here is the code that is in my themes function.php

    http://pastie.org/3376093

    I'm not sure I even put it in there right but nothing is changing on the results page.

    All of your help is so appreciated!

    Posted 12 years ago on Monday February 13, 2012 | Permalink