• Resolved c0nd3x

    (@c0nd3x)


    Hello!

    Some time ago you helped me create a formula to create discount codes that worked very well, but in the last update does not work anymore.

    This is the code:
    (function () {var discount = 0; // Here’s an X saying missing “use strict” statement //
    if ([field_rnField23] == ‘LACA350’)
    discount = 350;
    if ([field_rnField23] == ‘LACA600’)
    discount = 600;
    return [field_rnField11] – discount;
    } ())

    Field23 is the id of the field that will hold the coupon code
    Field11 is the id of the field that will hold the donation amount
    Where do I put the field that receives the number of people?

    In the form I have a multiple radio field with two defined prices $ 650 and $ 750 and a field of number of people multiplying the price.
    this code I enter it in a field of total of only read and I appear undefined

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author EDGARROJAS

    (@edgarrojas)

    Hello!

    I just checked your form and it seems that it only has this formula:

    [field rnField11]*[field rnField12]

    It doesn’t seems to be using the discount code formula. Coud you check your form and make sure the formula is still there please? Or could you send me a link to a form that still has the formula so i can check why is not working anymore (you could clone the form and add it to a test page).

    Regards!

    Thread Starter c0nd3x

    (@c0nd3x)

    Hello Edgar!

    this is the new link to the form test
    https://www.lacaymca.org/yysa2017/prueba/

    I tryed to do the formula and I put this:
    (function(){var discount=0;
    if([field_rnField23]==’LACA350′)
    discount=([field_rnField11]*[field_rnField12])-300;
    if($$field_rnField23$$==’LACA600′)
    discount=([field_rnField11]*[field_rnField12])-600;
    return [field_rnField11]*[field_rnField12]-discount;
    }())

    Field23 is the field that will hold the coupon code
    Field11 is the field that will hold the paid amount
    Field12 is the field that will hold the people amount

    thank you so much

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Please try with this formula (which is practically the same but without the first and last lines which i think are causing this issue):

    var discount=0;
    if ([field rnField23] == “LACA350”)
    discount = 350;
    if ([field rnField23] == “LACA600”)
    discount = 600;
    return [field rnField11] – discount;

    I wasn’t able to test it though since i don’t have a copy of your form but if it doesn’t work please let me know and i will check it again.

    Regards!

    Thread Starter c0nd3x

    (@c0nd3x)

    Hello!

    the formula works better, but the discount does not work the way I want.
    I have the field of payment and the field number of people these two fields are multiplied to give the total and the discount subtracts from the total, I think the formula would be like this ((#people*$payment)-discount), but in the form alone take the discount field and do not make the formula.
    you can see it at https://www.lacaymca.org/yysa2017/prueba/

    This is the code I did with your last example

    var discount=0;
    if([field_rnField23]==’LACA350′)
    discount= (([field_rnField12]*[field_rnField11])-350);
    if([field_rnField23]==’LACA600′)
    discount= (([field_rnField11]*[field_rnField12])-600);
    return [field_rnField11]*[field_rnField12]-discount;

    Thread Starter c0nd3x

    (@c0nd3x)

    Hi edgar!

    I already organized the code and it works me very well!

    Thank you very much for your help

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Ah great =).

    Let me know if you have any other question.

    Regards!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Discount Code’ is closed to new replies.