WordPress.org

Ready to get started?Download WordPress

Forums

Calculated Fields Form
[resolved] If and Else integration (8 posts)

  1. Dinitrophenol
    Member
    Posted 1 year ago #

    Hi, first of all I bought your plugin two weeks ago and I must say that the investment is fully profitable.

    Could you please correct me, I do not find the error.
    So we have dimension A (FieldNameH x fieldnameL)*fieldnameQuantity.
    From 0 to 150 is included, is multiplied by (( 0.19)+ 40)
    Between 150 and 400 inclusive, is multiplied by ((0.19 )+ 80)
    Beyond 400, multiply by 0.19
    Thus, So I draft the following function:

    (function(){if(((fieldname27*fieldname26)*fieldname57) <= 150){
    ((((fieldname27*fieldname26)*fieldname57)*0.19)+40)}else if(((fieldname27*fieldname26)*fieldname57) =>151 && <=400){
    ((((fieldname27*fieldname26)*fieldname57)*0.19)+80)}else if(((fieldname27*fieldname26)*fieldname57) > 400){
    ((((fieldname27*fieldname26)*fieldname57)*0.19)}
    })()

    The field is hopelessly empty, so please Moderator : pimp my function ! Thanks:)

    http://wordpress.org/extend/plugins/calculated-fields-form/

  2. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    The issue is very simple, you must to return the function's result. I propose you an optimized version of your equation:

    (function(){
    var to_compare = fieldname27*fieldname26*fieldname57;
    if(to_compare <= 150){
    return to_compare*0.19+40;
    }else if(to_compare > 150 && to_compare <= 400){
    return to_compare*0.19+80);
    }else if(to_compare > 400){
    return to_compare*0.19;
    }
    })()

  3. Dinitrophenol
    Member
    Posted 1 year ago #

    Thank you for your reply. unfortunately I tried without success.
    There are no other variables involved in the equation and all necessary tags are there.
    Where do you think the problem come ?
    Thanks

  4. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    I'm sorry, I forgot remove a parenthesis:

    (function(){
    var to_compare = fieldname27*fieldname26*fieldname57;
    if(to_compare <= 150){
    return to_compare*0.19+40;
    }else if(to_compare > 150 && to_compare <= 400){
    return to_compare*0.19+80;
    }else if(to_compare > 400){
    return to_compare*0.19;
    }
    })()

  5. Dinitrophenol
    Member
    Posted 1 year ago #

    It does not work either.
    I controlled the fieldname26 27 57 (height x width x quantity) and the price variable, but still no figure in the field result.
    Would you have another function please? May be different way.
    Again thanks for your help

  6. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    Please, could you contact me through our support system, please?

    http://wordpress.dwbooster.com/support

    I'll need the WordPress access for checking the form structure.

    Best regards.

  7. Dinitrophenol
    Member
    Posted 1 year ago #

    Of course, thanks for your help.
    Contact sheet is done. I will post your equation solution here to help any need it.
    Many Thanks

  8. Dinitrophenol
    Member
    Posted 1 year ago #

    Thanks Mike for your precious skills and your fast help.
    Support of this plug is excellent. I recommand

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.