• Resolved mrdude23

    (@mrdude23)


    Hi there,
    I’m trying to figure something out… I want to have a calculator for my costumers (Animations) where you can select some things (Style, Music, Commentary, etc) and then set the slider for the length of their film. Starting with 30 sec, in 30sec-Steps up to 180sec.
    My Problem is, that the price should not double every 30 seconds but decrease exponentially. For excample: There is a Basic-Price for 30 sec. 60sec should be 50% above that Basic-Prise. 90sec should ad another 40% of the basic price and so on.
    Is there a way to show those 30 Seconds-Steps on the website, but calculate with different values, or should I go with Radio Buttons?

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

    (@codepeople)

    Hello @mrdude23

    The project’s can be implemented easily with the slider control. As you have defined the step equal to 30, the possible values of the slider are : 30, 60, 90, 120, 150 and 180

    So, assuming the slider field is fieldname1, and the basic equation: fieldname2+fieldname3

    The equation should be edited as follows:

    
    (function(){
    var result = fieldname2+fieldname3, 
    duration = fieldname1;
    
    if(duration == 30) return result;
    if(duration == 60) return result*0.5;
    if(duration == 90) return result*0.4;
    })()
    

    Now, you simply should to include the other conditional statements.

    Best regards.

    Thread Starter mrdude23

    (@mrdude23)

    Wow, that was fast. It works perfectly. Thank you so much!

    Thread Starter mrdude23

    (@mrdude23)

    Hello! I ran into another problem ??
    I’m trying to put another Checkbox option into the equation from above. Basicly: If checked the result should ad another 20%, if not, nothing happens. The easiest way would be to multiply by fieldname8, but if not checked fieldname8 is 0. I tried putting another if into the equation, but nothing changes.

    (function(){
    var result = fieldname3+fieldname8,
    duration = fieldname4;
    percent = fieldname7;

    if(duration == 30) return result;
    if(duration == 60) return result*1.5;
    if(duration == 90) return result*1.9;
    (…)
    if(percent == 0) return result;
    if(percent == 1.2) return result*1.2;
    })()

    I’m quite shure I’m not that far off. But where? ??

    Plugin Author codepeople

    (@codepeople)

    Hello @mrdude23

    The solution would be simpler, and alternative would be:

    
    (function () {
      var result = fieldname3 + fieldname8,
          duration = fieldname4,
          n = 1;
    
      if (duration == 60) n = 1.5;
      if (duration == 90) n = 1.9;
    	
      n += fieldname7;
      return result*n;
    })()
    

    Best regards.

    Thread Starter mrdude23

    (@mrdude23)

    Thanks a bunch! It actually didn’t quite work for me, but I found my way. Your equation added another 20% to the basic result. I wanted to add 20% to the end result. I fixed it by adding

    g = 1;
    (…)
    if(fieldname7 == 1) g = 1.2;
    return result*n*g;

    Now it adds another 20% to the final result.

    Thank you very much for your help!

    • This reply was modified 5 years, 6 months ago by mrdude23.
    Plugin Author codepeople

    (@codepeople)

    Hello @mrdude23

    Thank you very much for sharing your solution.

    Best regards.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Set Slider Values to different value than displayed’ is closed to new replies.