I have made a form in product_info to calculate the amount of boxes needed to tile a certain area.
Code:
<div id="calculate">
<form name="Credit" action="">
  <table border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td>Αριθμός m2 =&nbsp;</td>
      <td><input type="text" name="First" size="14"></td>
    </tr>
      <tr>
      <td>&nbsp;</td>
      <td><input type="hidden" name="Last" size="14" value="<?php echo $products_url; ?>"></td>
      </tr><?php
    } // $flag_show_product_info_url
  }
?>
      <tr>
        <td>Κιβώτια =&nbsp;</td>
        <td><input type="text" name="Full" size="14"></td>
      </tr>
<tr><td>&nbsp;</td><td>
        <input type="button" value="Υπολογισμός!" onClick="som()" >	
      </td></tr></table>
	  </form>
	  </div>
</div>
I put a javascript file in includes/modules/pages/product_info/jscript_calc.js with the following script:
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);
}
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.
I would like to if this can be done, either in the javascript file or php script.