I have made a form in product_info to calculate the amount of boxes needed to tile a certain area.
I put a javascript file in includes/modules/pages/product_info/jscript_calc.js with the following script:Code:<div id="calculate"> <form name="Credit" action=""> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td>Αριθμός m2 = </td> <td><input type="text" name="First" size="14"></td> </tr> <tr> <td> </td> <td><input type="hidden" name="Last" size="14" value="<?php echo $products_url; ?>"></td> </tr><?php } // $flag_show_product_info_url } ?> <tr> <td>Κιβώτια = </td> <td><input type="text" name="Full" size="14"></td> </tr> <tr><td> </td><td> <input type="button" value="Υπολογισμός!" onClick="som()" > </td></tr></table> </form> </div> </div>
It calculates the amount of boxes needed per amount of m2 tiled area just fine. I would like to put the outcome of the calculation in the shopping cart as number of products to order.Code:function som() { var First, Last, Full; First = document.Credit.First.value; Last = document.Credit.Last.value; Full = document.Credit.Full.value; document.Credit.Full.value = Math.ceil(First / Last); }
I would like to if this can be done, either in the javascript file or php script.



