I am wanting to create a simple calculator. I have two sliders width & depth which I have successfully multiplied to create the square meter figure. Once we have this figure I then want this figure to multiply by one of three levels of specification chosen from a select box:
Each time I try this it doesn't multiply the sqm result by the specification level.
Could you give me some pointers as to how I can get this working?
Many thanks in advance
Thank you for purchasing our plugin.
In order to have this calculation, the best option is to use Cost Calculator group element, and define it with pseudo code.
In order to do that, first please add all these elements to the group, and then the pseudo code would look something like this:
width = $1;
depth = $2;
level = $3;
final = (width * depth) * level;
Please note that this is just an example, and you might need to adjust the code according to your needs.
You can find additional info on the Cost Calculator group in our online documentation.
Let us know if you need additional assistance.
Regards, BoldThemes team
If you like our products please consider leaving us a rating.
A huge thank you from BoldThemes in advance!
Thank you for your quick reply. I have created a new calculator with the CCGroup > CCMultiply > CCSlider + CCSlider + CCSelect.
When I try to add the code you suggested to the CC Multiply, I don't have an edit button? When I try adding the code to the CCGroup before adding the fields, the CCMultiply does not show in the options to pick?
I am sure I am missing the obvious here!
I solved my problem. I didn't need the CCMultiply element! Just added CCGroup with the equation you suggested >CCSlider + CCSlider + CCSelect = it works, giving me the prices I expect.
Many thanks for your help today!
We are glad you have managed to resolve the issue.
Please let us know should you need additional assistance.
Looking at the code you gave me:
If I want to take this a stage further, saying if width * depth = less than 9, level 1 would be 850 if greater than 9 it would be 750. Same with Level 2 & 3. Level 2 if less than 9 would be 1150 if greater than 9 it would be 1000, and Level 3 if less than 9 would be 1700 if greater than 9 it would be 1500.
How would I go about stating this in the Group and in the Select box?
Thank you for your help on this, very excited how it will benefit my customers :)
It is not possible to change values of select item (level) depending on the total of width and height.
In order to get similar calculation, you can set the select item's values to, for example, 1,2, and 3. And then in pseudo code add calculation like this:
width = $1;
depth = $2;
if ((width < 9) && (height < 9)) x == 850;
if ((width > 9) && (height > 9)) x == 750;
final = (width * depth) * x;
In this case, the x represents level. Please note that this is just an example, and it needs to be further adjusted, according to your needs.
Let us know if you need additional help.
Thanks for such a quick reply. I see what you are saying here. So, would I have to remove the CCSelect element, where they choose a specification level from the form, with this working?
Yes, if the value will be calculated within pseudo code, it is not necessary to have this element in the calculator.