Passing total to the payment processor tool after running total through complex discount structure

  • SunbridgeInstitute
    Asked on March 24, 2016 at 2:00 PM

    Hi friends at Jotform,

    I'm hoping you can help me with a complex discount structure that our institute is implementing.

    For some background, we sell summer-time courses:22 different courses, at 8 different price-points.

    We would like to offer our new discount structure with the following mathematical logic:

    If more than one course is purchased, you receive 10% off ALL the lesser-cost selections, AFTER the highest priced selection is paid at full price.

    Can you tell me what is the best way to accomplish this in Jotform?

    By the way, our current form has the old discount structure implemented; I have not given this new structure a try yet.

    Thank you so much for your help!

     

  • Ben
    Replied on March 24, 2016 at 2:39 PM

    I took a look at your form and I see that you were passing the value that should be charged for to the payment processor tool - Authorize.net in your case.

    Now if I understood you correctly the discount(s) get applied to the total automatically per these rules:

    1. If 1 course is purchased, there is no discount applied

    2. if multiple courses are purchased, you wish to give 10% only to the less costly courses, without applying any discount to the more costly one(s).

    3. If the more costly ones are not taken, the discounts are not applied

    Is this right?

    Also, I presume that the courses are the ones listed in the field with a label: "Please indicate your choice of course(s)/workshop(s)"?

    If the above is correct would there be any indication of which course is higher paid - should not have a discount applied to, and lesser value - to which the discount would not be applied (like a range, or specific "code" within the field, etc).

  • SunbridgeInstitute
    Replied on March 24, 2016 at 2:54 PM

    Yes, you are understanding correctly, although I'm not sure what you mean by #3. If any 2 (or 3, or 4, or 5, etc) courses are purchased, then the person will get a discount. The only course(s) which get a discount are whichever ones are of equal or lesser value than the highest one which is charged at full price.

    Also, I should clarify that if the person chooses two courses of equal value, which are also the highest priced courses of their selection, then the second of those two courses also gets a discount. 

    So there is always one highest-priced course that is paid in full, then discounts on all the rest of the courses chosen.

    Yes, you are correct that the "Please indicated your choice of course(s)/workshops" is the source of the courses being chosen.

    The source for the prices is all the way down at the bottom, with the label: "Please indicate [with calculation values]." This field has calculation values for each course under Edit Properties.

    I look forward to hearing your ideas!

    Thank you so much!

  • Ben
    Replied on March 24, 2016 at 3:27 PM

    OK, thank you for the additional details. Based on what you have mentioned it means that you would be searching for the highest value of those that are selected - not from all fields.

    This is easy to do with custom codding, but due to constraints of the builder (in order to keep it simple) it is not possible to do the same in a simple manner or not at all.

    Basically, and I am posting this for reference, this is the complete overview of the implementation:

    1. If 1 course is purchased, there is no discount applied

    2. if multiple (more than one) courses are purchased, you will give 10% to all courses except to the one with the highest amount to be charged

    3. if there are several courses that have the same highest value then only one of them is not discounted, while all the others are.

    Thank you for the values, I see them there:

    $480
    $775
    $775
    $775
    $775
    $775
    $775
    $480
    $480
    $840
    $480
    $480
    $40
    $480
    $805
    $285
    $295
    $480
    $285
    $480
    $285
    $225

    Now, I would only like to ask you to make all the changes to your form that you had planned - related to courses as such. That would allow us to help you work on the final parts of this and to avoid any changes later on.

    I have an idea how this might be done through the form builder, but as mentioned, would like to know if all of the values, fields, etc are finalized or near the finish.

    I will however try to see if the idea would be something that we could use here.

  • SunbridgeInstitute
    Replied on March 27, 2016 at 11:35 AM

    Yes, everything above is correct. The list of courses that we have on the form currently is the final list. There will not be any further changes. So you can go ahead and demonstrate your idea. Thank you very much!!

  • David JotForm Support Manager
    Replied on March 27, 2016 at 12:14 PM

    Thanks for the confirmation, we will let you know if there is a way around to implement this with our builder.

  • SunbridgeInstitute
    Replied on March 29, 2016 at 8:52 AM

    Can you give me an estimated timeframe that I might receive your ideas? I have a whole team here that is wanting to know the status. Thank you so much!

  • mert JotForm UI Developer
    Replied on March 29, 2016 at 10:21 AM

    Hi there,

    I'm sure that my colleague will return to this thread. I can't give you any ETA; but while you are waiting for his reply, I did some investigations on your form and created a sample integration for "Combination discount: 2-day workshop" field.

    Please, check its setting from the below:

    Passing total to the payment processor tool after running total through complex discount structure Image 1 Screenshot 20

     

    So, if any of the workshops are selected, it calculates the "Tuition Subtotal"'s %10 and print it on the field "Combination discount: 2-day workshop". Finally, the value will be extracted from the "Tuition Total". I hope this one will close to your needs. Please, share your idea about this one.

     

    Thanks.

  • SunbridgeInstitute
    Replied on March 29, 2016 at 12:08 PM

    Thank you for taking a stab at it, but this solution does not meet the needs of my situation, which Ben summarized nicely in his March 24, 2016 at 03:27 PM Posting.

    I look forward to hearing what Ben had in mind when he said that he had an idea how to accomplish it. 

    Thank you again!

  • SunbridgeInstitute
    Replied on April 1, 2016 at 9:36 AM

    Dear Jotform team, 

    Could I politely ask what the status is on this ticket? When Ben gave his final answer on March 24, it sounded like it was possible to accomplish the challenge presented, but I have not heard any updates (other than the unworkable suggestion by Mert on March 29) since then. Is this still an open ticket? Should I submit a new ticket? Usually you guys are not taking anywhere near this long to answer help questions.

    My dilemma is probably fairly common: Buy one at full price, then get all the rest of your purchases of equal or lesser value at a 10% discount.

    If this can be done in Jotform, I'm guessing that lots of your clients will be pleased to see the solution.

    If it cannot be done in Jotform, I would like to be informed so that I can stop spending my time on it.

    Please do give me an update.

    Thank you very much!

  • Ben
    Replied on April 1, 2016 at 11:10 AM

    Hi,

    Sorry about the long wait. As mentioned in my earlier reply this is something that I have an idea on how to approach so that it is possible to do within the form builder.

    I want to assure you that your thread is 1st in my todo list. Unfortunately when such custom solutions are needing assistance, especially if they might take a bit of time to be done, we can not work on them if forums is very busy and it happened to be as such.

    I do want to apologize again, we all thought that we would be able to help you with this earlier on, and I have talked with our manager about the same just now. I have cloned your form and will be working on the same later today, but I will update you here as soon as I am able to dedicate the needed time and provide a working solution.

    Thank you for your understanding.

  • SunbridgeInstitute
    Replied on April 1, 2016 at 11:36 AM

    Thank you very much for replying and explaining. I appreciate your help very much.

  • SunbridgeInstitute
    Replied on April 5, 2016 at 12:19 PM

    Any word yet? I'm so sorry to keep asking, but there is a lot of pressure on me to accomplish this, and it's making me look bad since I'm the one who asked for us to change from Formstack to Jotform.

    If you have not started tackling it yet, please make a fresh clone of my form, since I made some extra tweeks to the form a few days ago.

    Thank you again...

  • Ben
    Replied on April 5, 2016 at 3:19 PM

    Thank you for your patience on this and do not worry about asking, we understand your position.

    The idea I had was to grab the selections and find the one with the biggest value. This was planned to do by using the Max() function in the form calculation functions.

    Then as we do so, to simply:

    1. take the max amount from the total

    2. apply 10% discount to the rest

    3. add the max amount back to the total

    - This would allow us to get the right calculation setup that we need and make it all work.

    Now the issue here is that the functionalities of the builder are limited, and do not allow us to do this in an easy manner. - For example the Max() function will return maximum out of several fields, not from a set of selections in a single field and similar.

    Due to that, there is a workaround to my original idea through conditions. Basically we are starting from the list of amounts that will be used as charges:

    $480
    $775
    $775
    $775
    $775
    $775
    $775
    $480
    $480
    $840
    $480
    $480
    $40
    $480
    $805
    $285
    $295
    $480
    $285
    $480
    $285
    $225

    Now, we note the groups:

    1. $840 (1)
    2. $805 (1)
    3. $775 (6)
    4. $480 (8)
    5. $295 (1)
    6. $285 (3)
    7. $225 (1)
    8. $40 (1)

    So, now we make a conditions check to see if some of the groups were selected (while ignoring the last one of $40 as it would never be max)

    This is set up by creating conditions as so:

    Passing total to the payment processor tool after running total through complex discount structure Image 1 Screenshot 50

    Max is the new textbox that we have added to our form prior to creating the conditions. I have placed it under the tuition subtotal and it is not hidden for now, but should be later on.

    Now we recreate the same for other groups as so:

    Passing total to the payment processor tool after running total through complex discount structure Image 2 Screenshot 61

    Now, the max field will hold the biggest value in selections. Trick here is that we might happen to have only one option selected and it would be set as max and we do not want that. To counter that, we just add a condition that compares the Max and Tuition subtotal fields. If the value is the same, we put 0. If the value is not the same it means that more fields have been selected and we can use the Max value as true max.

    Now Max-finail is the one that would be used for total, so this is how we make sure that there are multiple selections made:

    Passing total to the payment processor tool after running total through complex discount structure Image 3 Screenshot 72

    If we do not use it however, it is best to indicate this by making sure that there is a 0 in the field, so we add this condition as well:

    Passing total to the payment processor tool after running total through complex discount structure Image 4 Screenshot 83

    Now, we get the maximum value to this field only if more options are selected and otherwise we get 0 in there.

    Now, the trick is on getting the total. This is something that you might want to change depending on your setup and preferences, but what I did, was to:

    1. grab tuition subtotal

    2. take / subtract from it all coupon (alumni, and all 3 combination discounts) values

    3. take away from it the max-final value

    4. take away from it the same as first 3 steps * 0.10 (so that we get the 10% discount)

    5. add back the max-final amount

    6. that is it :)

    Please do let us know if you have any questions, and feel free to test out everything on my clone of your form: http://form.jotform.com/form/60955845528973

    If it works (calculates) as you wanted it to, feel free to copy it over to make any final adjustments to it as needed :)

    Do of course let us know if you have any questions in regards to the same as well.

  • SunbridgeInstitute
    Replied on April 6, 2016 at 2:09 PM

    This is an absolutely brilliant solution!! I am having one difficulty with it, however, and I can't seem to figure out WHY, since your logic is very sound...

    Often when I chose one item in the $480 category (such as Approaching Grade 7), it discounts that item even though the Max-Final value is 0.

    It is happening this way on your clone of my form, and also on my new form here:

    https://www.jotform.com//?formID=60964858044970

    It does not do it every single time--it is sporatic--but most times it gives a discount on the one item.

    I did tweek your solution a bit on my new form (60964858044970) because it needed one extra condition for when Max-Final was zero, and I also had some old discount structures to remove.

    I have also tested this solution thoroughly, and all the other combinations are working brilliantly.

    If we can get this one little bug worked out, then I can launch this new form in good shape!

    Thank you so much for your awesome help!! I hope you will be using this as a new tutorial for other users--I'm sure that others could use a "Buy one at full price, then get all the rest of your purchases of equal or lesser value at a 10% discount." solution.

  • Ben
    Replied on April 6, 2016 at 3:04 PM

    Great to hear that you loved it :) Also thank you for the suggestion. Since this thread is public, anyone can actually see it and find the same when looking for the similar logic.

    Now seeing that there is a bug, I am happy to assist in resolving the same :)

    Looking at the prices list again:

    $480
    $775
    $775
    $775
    $775
    $775
    $775
    $480
    $480
    $840
    $480
    $480
    $40
    $480
    $805
    $285
    $295
    $480
    $285
    $480
    $285
    $225

    It means that the following options sometime get discounted:

    A Fresh Look at High School English: July 10-13
    Approaching Grade 7: July 10-13
    Approaching Grade 8: July 10-13
    Considering First Grade Readiness: June 26-29
    Creative Lessons in Science & Technology for Grades 1-6: July 17-20
    Fostering the Mood of the Fifth: July 24-27
    Recognizing Learning Challenges: June 26-29
    Storytelling through the Grades: July 17-20

    I have tried to make a different selections and di-selections on the form to try and recreate the same, but as soon as the max matches the value in tuition subtotal it goes down to 0 again - as it should.

    I have also tried to select and refresh and similar approach to see if it might cause it to break

    The only "issue" that I was able to get to be shown is to select an option (or two), then refresh the form. Now as it is refreshed, to remove the selections. When I did that, the form had shown me the values that were there before the refresh (instead of 0s).

    To counter that, I just added another condition that checks if the courses fields is empty and if so, places 0 in Max field and change one existing condition for Max field. This will change how the max-final is checked against and should make it all work nicely together.

    Hopefully this was the cause of the issue you had noticed and will resolve the same :)

    This is the clone with the applied patch:

    form.jotform.com/form/60965742021958

    To avoid having to recreate email related conditions, the following changes are done (2) in conditions:

    Passing total to the payment processor tool after running total through complex discount structure Image 1 Screenshot 40

    Now instead of the previously added condition that was set as so:

    Passing total to the payment processor tool after running total through complex discount structure Image 2 Screenshot 51

    We check it if it is greater than the Max field. Meaning that we only need to add 1 condition (that we added above) that sets the value of tuition total to 0 instead of setting all of the fields to 0, and to avoid value from Max to be added to Max final simply because it is not equal to the tuition subtotal.

    This is the end result of the change:

    Passing total to the payment processor tool after running total through complex discount structure Image 3 Screenshot 62

    This seems to resolve the issue of the max value being wrong if you select and then refresh the browser and then deselect the options (I must say however that this is not a usual thing for someone submitting the form, but is something that someone testing the form might do).

    Do however check it out and let us know how it goes.

    I do wish to point out just one more thing. In my test, I tried setting the value of 0 to tuition subtotal at first, but it was leaving it with 0 all the time due to some other condition, so we still have this to work on, but in the meantime the approach above will show you if the max final field gets wrong values again by any chance. If not, it means that we are going in a right direction and can find out how to solve that as well :) or in case it is needed, backtrack and try another fix.

  • SunbridgeInstitute
    Replied on April 7, 2016 at 10:22 AM

    Hello there,

    Thank you again for following up on this. I have been playing with your clone (http://form.jotform.com/form/60965742021958) and unfortunately it is still behaving the same way, and so I cannot release the form to the public yet.

    After reading through your last response, it seems that we are looking for the described bug in two different places. You are focusing on whether the Max field has 0 (which seems to me always correct), but the field I am focusing on is "Total Tuition."

    I am attaching a screen shot of the error so you can see the "Total Tuition" at the bottom. Only one course has been selected in these pictures, and the resulting "Total Tuition" should be equal to the "Tuition Subtotal." Most times, however, it gets discounted. 

    I considered your thoughts about the dynamic of testing a form versus using a form in real life, so I asked several of my coworkers to use your form and select one of the problematic courses (without selecting anything else), and see what happens with the Total Tuition. They are getting the same results as I was--3 out of 4 got a discount on one single course selection in the $480 range.

    Is there any work-around that can be added so that my Total Tuition field is the same as the Tuition Subtotal field every time there is only one course selected?

    Thank you again!!

    Passing total to the payment processor tool after running total through complex discount structure Image 1 Screenshot 40

    Passing total to the payment processor tool after running total through complex discount structure Image 1 Screenshot 40

    Passing total to the payment processor tool after running total through complex discount structure Image 1 Screenshot 40

    (it seems like these pictures are not working--can you see them? If not, hopefully my description was thorough enough)

  • Ben
    Replied on April 7, 2016 at 12:20 PM

    Hi :)

    Good catch, yes, I was looking at the wrong fields then.

    Unfortunately I can see where the images would need to be (3 based on what I see), but they are all "empty" - no images.

    Looking at the total tuition now I am not able to recreate the same. :/

    Since I do not see the error (for myself), I can not tell what might be happening. For that reason, I have moved the condition that is in charge of passing the tuition subtotal to tuition total at the top of the chain to make it more important than the other conditions. That should make it work as we want it, but as I can not recreate the issue, it seems to work all the time for me.

    Do however test it out and let us know if this does not help and if so, I will ask my colleagues if they can recreate the same.

    For reference, this is what I tried:

    1. select just one option from this list:

    A Fresh Look at High School English: July 10-13
    Approaching Grade 7: July 10-13
    Approaching Grade 8: July 10-13
    Considering First Grade Readiness: June 26-29
    Creative Lessons in Science & Technology for Grades 1-6: July 17-20
    Fostering the Mood of the Fifth: July 24-27
    Recognizing Learning Challenges: June 26-29
    Storytelling through the Grades: July 17-20

    2. check out total tuition

    3. re-check options, refresh form, etc - and look if the value changes from 480 (which is the default for those options) to discounted one: 432 (or any other value).

    If you are doing some other steps, do let us know.

    The updated form is the same one as before: http://form.jotform.com/form/60965742021958

  • SunbridgeInstitute
    Replied on April 7, 2016 at 12:38 PM

    Thank you for your quick reply. This is so strange, how it works this way on 5 of our computers most of the time, and yet on your one computer it does not happen even once?

    In hopes that your last tweek resolved our issue, I went in again, and no luck, it is still happening, from the first click.

    Here are the steps that I asked of my colleagues, which reproduces the error 90% of the time:

    Please click into the following form:  http://form.jotform.com/form/60965742021958
     
    In the form, skip down to the part that says: Please indicate your choice of course(s)/workshop(s)
     
    Now select ONE of the following courses as though you're going to take it (don't change your mind after picking one):
    A Fresh Look at High School English: July 10-13
    Approaching Grade 7: July 10-13
    Approaching Grade 8: July 10-13
    Considering First Grade Readiness: June 26-29
    Creative Lessons in Science & Technology for Grades 1-6: July 17-20
    Fostering the Mood of the Fifth: July 24-27
    Recognizing Learning Challenges: June 26-29
    Storytelling through the Grades: July 17-20

     

    ​Now scroll down a little bit til you see Tuition Subtotal and Tuition Total on the same screen.​ Are they equal to each other?
     
    I tried again to upload a screen shot but for some reason this function is not working at all, but I do have 11 different screen shots showing this error. Here is a summary of what they all say:
    Summary of your selections: (any one of the $480-cost courses listed above)
    Tuition subtotal: 480
    Max: 480
    Max-final: 0
    [some blank fields]
    Total tuition: 432
     
    Again, the total tuition should be 480, not 432.
     
    Thank you again if you can get this recreated in your office. My concern is that, since this happens on ALL of our computers, it is likely to happen amongst our submittors, even though it is not happening for your computer. I'm wondering if you might have an older computer in your office that you can try it on? Our computers are not ancient, but they are not brand new either.
     
    Thanks again for all your help!
  • Ben
    Replied on April 7, 2016 at 1:23 PM

    I have just tried again and while it seems that we are doing the exact same steps, it is still working properly for me.

    To show you this, I recorded my screen during the test and you can see it here.

    Now I presume that it might be related to the browser that we use.

    I for example use FireFox as much as I can. Can you tell me which one did you use (if all of you used the same one).

    This is the only thing that comes to mind since the power of the computer is not something that should be relevant to this as well (the test was made on a common -older- machine) as I prefer to work on the common configuration others would have :)

  • SunbridgeInstitute
    Replied on April 8, 2016 at 11:38 AM

    Okay, that is good thinking. We are using Chrome, as the vast majority of our clientele is using also, according to the analytics in Jotform. I hope this helps in the recreation of the problem we are having, and I hope this leads to a solution! I will watch my emails while home so that we can hopefully get this resolved today or tomorrow. Thank you so much!

  • SunbridgeInstitute
    Replied on April 8, 2016 at 11:42 AM

    I just tested your theory by running the form in Firefox, and with the first click, I'm still getting the discounted single course, so maybe this is not the answer. We are using Windows Professional 7 as a system, I'm pretty sure. Is there anything else that might make a difference?

  • SunbridgeInstitute
    Replied on April 9, 2016 at 7:24 AM

    Just to let you know, I also tried the form on my home computer, which is a macintosh, and I get the same error here also. 

  • Charlie
    Replied on April 9, 2016 at 10:48 AM

    I'm not sure if the workaround I have in mind is somewhat the same with my colleague Ben. But you also try this. I see you already have a progress in your conversation. I'll notify Ben about the bug.

     

    In my case, based from my understanding in your discount prices. Here's how I will work it out:

    1. Here's my sample form: https://form.jotform.com/60993395072969. The calculation is at the very bottom, I did not change the or edit the existing one so that you can see if they output differently. You can clone my form by following this guide: https://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL 

    2. First, I set up 22 text boxes to associate with all the courses you have.

    Passing total to the payment processor tool after running total through complex discount structure Image 1 Screenshot 90

     

    3. Now we will have the following elements:

    "Highest Value" => This is the highest value in your selected courses

    "Count" => This is the number of courses selected

    "Total without Discount" => The sum of all the courses selected without the discount

    "Total Calculation" => The sum of all the courses selected with the discount rules.

    All of those elements are "Form Calculation" widgets.

    Passing total to the payment processor tool after running total through complex discount structure Image 2 Screenshot 101

     

    4. Now, the first one we need to do is assign the values on each text boxes.

    Example: IF "course/workshop" is equal to "A Fresh Look at High School English: July 10-13" then insert "480" in the text box "Course 1 Value".

    Repeat the same condition to the other 21 text boxes.

    Passing total to the payment processor tool after running total through complex discount structure Image 3 Screenshot 112

     

    Now why do we want to do this? We have a function called nth(), this gets the nth highest value in your group of fields. Proceed on the next step to see this.

     

    5. The nth() function will be use to get the highest value of the selected fields. We will apply it in our "Highest Value" form calculation widget.

    Below is how it is setup, find the math function nth() under the "..." button. My calculation works like this:

    nth(1, "Course Value 1", "Course Value 2", "Course Value 3"... so on)

    What it does is it finds the highest value in all of our text boxes.

    Passing total to the payment processor tool after running total through complex discount structure Image 4 Screenshot 123

     

    *Note: Unfortunately, the nth() does not work in check boxes, because a check box field is only one field, so it gets the total of it. That's why we use separate text boxes.

     

    6. Now we want to check how many of our courses are selected. We will use another math function called count() in our form calculation widget named "Count". I will count the number of check boxes selected in our courses. Note that I am using the check box that does not have the calculation values. I see you have two sets of check box courses, the one has a calculation value and the other has none.

    Passing total to the payment processor tool after running total through complex discount structure Image 5 Screenshot 134

     

    7. I will now get the sum of the selected check boxes. I'll use another widget and name it "Total (without discount)". Here I simply selected the check box that has the calculation values, so it simply adds them all automatically.

    Passing total to the payment processor tool after running total through complex discount structure Image 6 Screenshot 145

     

    8. Now how do we setup the conditions for the final total? I used another form calculation widget and named it "Total Calculation".

    We will have two conditions:

    Condition 1:

    IF the count is less than 2 (meaning only 1 or below) then insert the check box course with the calculation value without any kind of discounting.

    Passing total to the payment processor tool after running total through complex discount structure Image 7 Screenshot 156

    Condition 2:

    IF count is greater than 1 (meaning 2 or more) then do this calculation:

    ( ( total without discount - highest value) * 0.90 ) + highest value = total calculation with 10% discount on all courses that is less than the value of the highest course.

    Passing total to the payment processor tool after running total through complex discount structure Image 8 Screenshot 167

     

     

    I see you have also other discount rules like "additional discount: Waldorf Weekend" and "alumni discount", I presume they are easier to implement now because they can simply be deducted with the total calculation? I have not applied them in my setup.

    Here's a reference for the math functions: https://www.jotform.com/help/267-Form-Calculation-Math-Function-Reference 

    Let us know if this approach would work.

  • Charlie
    Replied on April 9, 2016 at 10:55 AM

    Apologies, I have some typographical errors in my post, I have updated it. Please see view it directly using this link: https://www.jotform.com/answers/802071

  • SunbridgeInstitute
    Replied on April 9, 2016 at 8:47 PM

    Thank you so much for trying a different angle on this topic; I really appreciate your effort. My family got hit with flu so I will take a look at this as soon as I am able to focus on it. Hopefully it will be no later than Monday. Thanks again.

  • Charlie
    Replied on April 10, 2016 at 12:04 AM

    I'm sorry to hear that, I hope you and your family get well soon.

    Please do let us know if you need more assistance on this. 

  • Ben
    Replied on April 10, 2016 at 12:54 PM

    I was thinking about the issue and why it might be happening. No matter what I do I can not recreate it (even on Chrome). So I presume that for some reason it might be checking things differently on your side than on mine when it checks if the field is greater than 0.

    So I have added additional checks in conditions - basically to pass the tuition subtotal to tuition total if the value of max-final is 0 or if the same field is not filled out, and to only apply the discount if the max-final is filled out and greater than 0.

    Passing total to the payment processor tool after running total through complex discount structure Image 1 Screenshot 20

    This should definitely stop it from functioning improperly.

    I do suggest checking out the solution given by my colleague Charlie as well, especially how he approached the same. It might be better for you - for updating later, etc). Do feel free however to check if the final changes did anything for the old approach. This is the new clone: https://form.jotform.com/61005351248951

    Hope you all get better soon :)

  • SunbridgeInstitute
    Replied on April 15, 2016 at 2:11 PM

    I'm finally back in the office (my son has a very serious illness), and I tried out this new form (https://form.jotform.com/61005351248951and it is still not working. I'm getting exactly the same problem, that it is discounting a single entry. This one is a little worse than the other, because it is also discounting some of the $775 courses as well with a single selection.

    I took a look at Charlie's version also (https://form.jotform.com/60993395072969), and it is giving me similar problems...sometimes discounting a single entry. This version creates the error less frequently, but it still only took me about 4-5 tries to make it happen.

    I am getting these same errors on my home computer as well. I am beginning to wonder if there's something about the jotform computers that is a little unusual (or a little too perfect?), since I am able to create this problem any time and any where I try. Are there any other computers that are available to you for testing this problem? I definitely can't launch this form with the frequency of errors, and if I can't make this particular discount work on our form, that's going to be a big problem to our owner.

    I may be a little slower to reply, as I said, my son is very ill, but I will try back as soon as possible.

    Thank you again for your help.

  • Charlie
    Replied on April 15, 2016 at 3:51 PM

    I'm sorry, but we are still unable to replicate the problem, both in Ben's form and mine. We are actually in different time zones so the computers and devices that tests the forms are not really in the network or specifically setup in JotForm. 

    I'm not really sure how you are able to replicate it in your end, perhaps we are missing something? Do you have a specific work flow on how you are filling out the form? Do you prepopulate the URL, or do you use a session link of some kind? Or are the computers and your home browser connected to a universal office account where you need to login or sync your Gmail in the browser? You mentioned that in my form it is less frequent, and it takes 4-5 tries. Could you please tell us the steps on this? I know you have mentioned the steps in your earlier replies and we just need to select a single product and check the total. But is there any other fields you are filling out? Other than the list of courses?

    Another way to check this is by viewing the forms in incognito mode (Chrome) and private browsing feature (Mozilla Firefox). With this, you're viewing the forms with no history of any other session.

    Here's a screencast of me testing the form of Ben:

    First, I load the form then selected the first course, it shows 480 both in the total calculation and in the payment total.

    Second, I reloaded the form then selected the second course, it shows 775 both in in the total calculation and in the payment total.

    Passing total to the payment processor tool after running total through complex discount structure Image 1 Screenshot 20

    Please do update us anytime, we understand that you have a lot in your hands right now. We hope your son will get well soon.

  • SunbridgeInstitute
    Replied on April 25, 2016 at 1:55 PM

    Thank you for your patience on this ticket. My son has recovered, and I had a bunch of catch-up work, so now I'm back on the case here.

    I checked the version of chrome that I have, which could be part of the problem, right? Here is what it says:

    Version 49.0.2623.112 m
     
    An error occurred while checking for updates: Update check failed to start (error code 3: 0x800704C7 -- system level).
    This error message is certainly a red flag, but I have to assume that any of our users could easily have the same issue, since I have been running my computer without notice of update errors for god knows how long. 

    Here are the steps that I used to create the problem:

    Right-click into the test form link, and choose "open in Incognito window."
     
    Once in the form, skip down to the part that says: Please indicate your choice of course(s)/workshop(s)
     
    Select ONE of the following courses, with one click, without changing anything afterward.

    A Fresh Look at High School English: July 10-13
    Approaching Grade 7: July 10-13
    Approaching Grade 8: July 10-13
    Considering First Grade Readiness: June 26-29
    Creative Lessons in Science & Technology for Grades 1-6: July 17-20
    Fostering the Mood of the Fifth: July 24-27
    Recognizing Learning Challenges: June 26-29
    Storytelling through the Grades: July 17-20

    Now scroll down a til I see Tuition Subtotal and Tuition Total on the same screen.​ They should be equal to each other. Also, the amount under "Payment Information" should also match these two items.

    To test the form again (using a different test form or a different course name), CLOSE the incognito window, and open a fresh one for the next test.

    So I tested the two latest test forms using the method above, and got the following results:

     

    1. For Ben's latest form (https://form.jotform.com/61005351248951), it faulted on my first try, using course "A Fresh Look at High School English", giving me a "Total Tuition" of 432 rather than 480 that it should be.

    2. For Charlie's form (https://form.jotform.com/60993395072969), it faulted on my second try, using course "Approaching Grade 7," giving me a "Total Tuition" of 432 rather than the 480 that it should be.

    For some reason I'm not able to see the screencast that you posted. It shows a blank space.

    Thank you again for your help with this, and your persistence to find the missing link. I really love Jotform and would love (actually, need) for this form to work properly.

    Many, many thanks for your efforts, and if we can find a solution, I will be the first to toot your horns all over the internet!

  • Charlie
    Replied on April 25, 2016 at 3:26 PM

    I'm glad to hear that your son is well now.

    Regarding the problem, I went ahead and tested my form. I did see the problem. Here are the screenshots:

    1. First, I selected "Approaching Grade 7..."

    Passing total to the payment processor tool after running total through complex discount structure Image 1 Screenshot 60

    2. It showed correctly in the summary, and shows a value of 480 in tuition subtotal, max. But it shows incorrectly in "Total Tuition".

    Passing total to the payment processor tool after running total through complex discount structure Image 2 Screenshot 71

    3. It shows incorrect value in the payment total.

    Passing total to the payment processor tool after running total through complex discount structure Image 3 Screenshot 82

    4. However, if you scroll down, noticed that this is the other approach I mentioned. My clone form has two parts, screenshots 1, 2 and 3 shows the approach by my colleague Ben. Screenshot #4 and at the bottom of my form is the approach I mentioned. This is NOT tied to the payment integration as I would like to display the comparison of the two approaches so that you can set it up in your end. Noticed in my case that each course has a text box field, and because we selected "Approaching Grade 7...", the text box "Course 8 Value" is filled out.

    Passing total to the payment processor tool after running total through complex discount structure Image 4 Screenshot 93

    5. In the calculation, it still shows the correct total.

    Passing total to the payment processor tool after running total through complex discount structure Image 5 Screenshot 104

     

     

    Now my solution or calculation only works for this condition:

    IF course selected is greater than 1, then apply 10% discount to ALL the courses selected that is below the highest course value. IF course selected is just 1, then there's no discount.

     

    I see you have other discounts like Waldorf Weekend and some 2 or 5 day courses, but I am not quite sure if I understood them correctly. The only discount that I implemented is the one I mentioned above. You could clone my form and edit it and see if it will work for you. Please do scroll DOWN to my clone form and see the comparison there, if the problem persists even on that part, then I am not really sure what is causing this.

    Please do check the approach I mentioned on my post  April 09, 2016 at 10:48 AM. And try to recreate it in your form. I'll try to study the other discounts you have an implement it in my other cloned form.

  • Charlie
    Replied on April 25, 2016 at 3:42 PM

    I have permanently incorporated my approach on this cloned form that I have: https://form.jotform.com/61155531668963. My approach is now tied with the payment integration and other discounts. See if that still provides you the error in calculation.