• Resolved bcwraps

    (@bcwraps)


    Hello

    I am trying to do the calculations and display the sum of the width and height of my product.

    I created NOV variable called Area that is the sum of the width and height after it was automatically transformed in feet. My area is calculated only in SQ FT.

    I have the option for clients to enter sizes in Inches as well, then is transformed in ft then is calculated in SQ FT.

    Question is :
    How do I round up the total SQ FT if the clients choose inch as unit of measurement. I need to round up to a full sqft and then do the calculation of the price

    Eg: 8″ x 3″ = 0.17 sq ft . I need this to be rounded up to 1 sq ft

    here is the formula I use to display the total sq ft :
    Total Square Feet:
    {# var area=data.uni_nov_cpo_area;
    if(area) { #}
    <b> area.toFixed(2) sq ft </b>
    {# } #}

    Thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author moomooagency

    (@moomooagency)

    Thread Starter bcwraps

    (@bcwraps)

    Can you please exemplify based on the example I provided?

    width = 8″ x height = 3″ = total 0.17 sq ft . I need this to be rounded up to 1 sq ft

    Thanks

    Plugin Author moomooagency

    (@moomooagency)

    Ok. Please, write here your formula for calculating the area.

    Thread Starter bcwraps

    (@bcwraps)

    So I have
    {uni_cpo_price} = $5
    {uni_cpo_units} = the units of measurements ( ft, inch, cm )
    {uni_cpo_width} = the width
    {uni_cpo_height} = the height
    {uni_cpo_grommets} = (no grommets / grommets every 2 ft) as selector
    {uni_cpo_pockets} = pockets on ( top +$5*{uni_nov_cpo_width_f} / bottom +$5 / left +$5 right +$5) as checkbox

    NOV i have
    {uni_nov_cpo_height_f} is {uni_cpo_height} converted to ft
    {uni_nov_cpo_width_f} is {uni_cpo_width} converted to ft
    {uni_nov_cpo_area} = as. {uni_nov_cpo_width_f}*{uni_nov_cpo_height_f}
    {uni_nov_cpo_linear_ft} = as. {uni_nov_cpo_width_f}*2+{uni_nov_cpo_height_f}*2
    {uni_nov_cpo_grommet_price} = as {uni_nov_cpo_linear_ft}*0.25 when selected “grommets every 2 ft”

    {uni_nov_cpo_pret_final} = {uni_nov_cpo_area}*{uni_cpo_price}
    I use this {uni_nov_cpo_pret_final} to:
    1. generate the final calculated price
    2. generate the conditional logic rules to add to the price when the options of Grommets or Pockets is selected

    So now lets say:
    Width = 23 inch
    Height = 10 inch
    Total Square Feet: 1.60 sq ft
    Total Linear Feet: 5.50 L ft

    I need the total Sq Ft to be rounded up to 2 instead of 1.60

    ________________________

    Also it seams that with the formula to display price as {uni_nov_cpo_pret_final}
    Whenever I add the second option (pockets) or third ( lets say lamination) , price either don’t change or goes minus instead of adding to the base price.

    you can check online here

    Hope I explained all.

    Plugin Author moomooagency

    (@moomooagency)

    Hi. You put too much here. This is was I asking for:

    {uni_nov_cpo_area} = as. {uni_nov_cpo_width_f}*{uni_nov_cpo_height_f}

    Your formula is {uni_nov_cpo_width_f}*{uni_nov_cpo_height_f}, so transform it to: ceil({uni_nov_cpo_width_f}*{uni_nov_cpo_height_f}) and this is how you get the value of this NOV rounded up.

    Thread Starter bcwraps

    (@bcwraps)

    Thank you .
    Now it works as planned.

    Can I bother with one more question?
    In the price calculation. I have multiple lines of options as drop down menus or check boxes.

    How do I add them to the main formula?

    I need to add the grommets prices
    then add the hem price
    then add each checkbox for pockets.
    I described above the values and I sent the link to the page
    https://snipboard.io/D3rJwa.jpg

    Plugin Author moomooagency

    (@moomooagency)

    Generally speaking, you should just write it like var1+var2+var3+…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘dynamic notice calculation’ is closed to new replies.