Softdiscover / Zigaform-WP-Cost-Estimator-Lite

The ZigaForm Cost Estimation makes you build estimation forms in few steps.
https://softdiscover.github.io/Zigaform-WP-Cost-Estimator-Lite/
3 stars 1 forks source link

cost calculation doesnt work.... #4

Closed pinky-ring closed 3 years ago

pinky-ring commented 4 years ago

I'm trying to figure out how to estimate the cost for window cleaning... window cleaning zigaform

So I made two radio button choices 1)property type 2)side of windows(both side or only one side)

I try to make the true and false calculation and for commercial property, I assigned the price to be 0 for residential property, I assigned the price to be 1

and for one side only cleaning, I assigned the price to be 0 for both sides, I assigned the price to be 1

this is my calculation I tried... I tried many other calculations but nothing seems to work.... is there anyone who can help me out?


var propertyType=fld_uie3k7dqnrn_price; //I want the form to know it is commerical or residential var side=fld_uikb2uvxfy8_price; //I want the form to know that is for one side or both sides var subTotal=0; var total=0; var comWinSmall=2; //commercial properties small window price per side var comWinRegular=3; //commercial properties Regular window price per side var comWinLarge=5; //commercial properties Large window price per side var resWinSmall=3; //residential properties small window price per side var resWinRegular=5; //residential properties small window price per side var resWinLarge=8; //residential properties small window price per side

/ fld_uiaa2cr5irs_value is small window quantity fld_uiif03bzjml_value is regular window quantity fld_uiwb01xinft_value is large window quantity/

if (propertyType=0){ subTotal=(comWinSmallfld_uiaa2cr5irs_value)+(comWinRegularfld_uiif03bzjml_value)+(comWinLargefld_uiwb01xinft_value); total=subTotal; if(side=1){ total=subTotal2; } }else if (propertyType=1){ subTotal=(resWinSmallfld_uiaa2cr5irs_value)+(resWinRegularfld_uiif03bzjml_value)+(resWinLargefld_uiwb01xinft_value); total=subTotal; if(side=1){ total=subTotal2; } }else{ total=0; }

return total;

pinky-ring commented 4 years ago

I also tried this calculation but this one makes form not showing anything on summary anymore...


if (propertyType=0 && side=0){ subTotal=(comWinSmallfld_uiaa2cr5irs_value)+(comWinRegularfld_uiif03bzjml_value)+(comWinLargefld_uiwb01xinft_value); total=subTotal; }else if(propertyType=0 && side=1){ subTotal=(comWinSmallfld_uiaa2cr5irs_value)+(comWinRegularfld_uiif03bzjml_value)+(comWinLargefld_uiwb01xinft_value); total=subTotal2; } else if (propertyType=1 && side=0){ subTotal=(resWinSmallfld_uiaa2cr5irs_value)+(resWinRegularfld_uiif03bzjml_value)+(resWinLargefld_uiwb01xinft_value); total=subTotal; } else if (propertyType=1 && side=1){ subTotal=(resWinSmallfld_uiaa2cr5irs_value)+(resWinRegularfld_uiif03bzjml_value)+(resWinLargefld_uiwb01xinft_value); total=subTotal2; }

return total;

pinky-ring commented 4 years ago

I decided to use custom html instead of the radio button field. To make my own radio button with custom id   Now my math is working !! 🥳🥳🥳

But I need to fix one more bug....🤔 The total amount doesn't change automatically after switching the radio button. it will change after I change the window quantity...

Is anyone know the script to auto-refresh after switching the radio button choice??

larangin commented 4 years ago

hello, sorry for late response. try to use console.log in order to track values in the calculation code: https://www.w3schools.com/js/js_output.asp

did you figure it out? let me know how it goes

larangin commented 3 years ago

since there is no replies. I will close this issue