Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need ur help please


Guest

Recommended Posts

the following is an air freight calculator code, what i need is to intergrate it with product_info.php so the customer can add the outcome of the calculation to the cart..please help to do it...thanks..

<script LANGUAGE="JavaScript">

function calculate() {

var decimal_places = 1;

var volumetricWeight = ((frm.l1.value * frm.w1.value * frm.h1.value * frm.p1.value) + (frm.l2.value * frm.w2.value * frm.h2.value * frm.p2.value) + (frm.l3.value * frm.w3.value * frm.h3.value * frm.p3.value) + (frm.l4.value * frm.w4.value * frm.h4.value * frm.p4.value) + (frm.l5.value * frm.w5.value * frm.h5.value * frm.p5.value));

volumetricWeight /= 6000;

var valceiling = Math.pow(10,decimal_places);

volumetricWeight = (Math.ceil(volumetricWeight * valceiling)) / valceiling;

if (volumetricWeight > frm.gross_weight.value) {

frm.chargeable_weight.value = volumetricWeight;

} else {

frm.chargeable_weight.value = frm.gross_weight.value/1;

}

frm.volumetric_weight.value = volumetricWeight;

}

function checknum(valbox) {

var str=valbox.value;

for (var i = 0; i < str.length; i++) {

var ch = str.substring(i, i + 1)

if (ch < "0" || ch > "9") {

if (ch != ".") {

valbox.value="";

}

}

}

calculate();

}

function () {

if (3) {

}

if (1) {

}

if (0) {

value = 6000;

}

if (frm.l1.value || frm.w1.value || frm.h1.value) {

if (!(frm.l1.value && frm.w1.value && frm.h1.value)) {

}

}

if (frm.l2.value || frm.w2.value || frm.h2.value) {

if (!(frm.l2.value && frm.w2.value && frm.h2.value)) {

}

}

if (frm.l3.value || frm.w3.value || frm.h3.value) {

if (!(frm.l3.value && frm.w3.value && frm.h3.value)) {

}

}

if (frm.l4.value || frm.w4.value || frm.h4.value) {

if (!(frm.l4.value && frm.w4.value && frm.h4.value)) {

}

}

if (frm.l5.value || frm.w5.value || frm.h5.value) {

if (!(frm.l5.value && frm.w5.value && frm.h5.value)) {

}

}

if (str == "") {

}

for (var i = 0; i < str.length; i++) {

var ch = str.substring(i, i + 1)

if (ch < "0" || ch > "9") {

if (ch != ".") {

}

}

}

submit();

}

</SCRIPT>

 

<!-- Main Content Start-->

 

<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="1" WIDTH="500">

<FORM NAME="frm">

<TD ALIGN="center">Weight KG</TD>

<TD><INPUT TYPE="text" NAME="gross_weight" SIZE="5" MAXLENGTH="5"></TD>

<TR>

<TD ALIGN="center" VALIGN="TOP">Dimensions CM</TD>

<TD>

<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" WIDTH="200">

<TR>

<TD align="center">Length</TD>

<TD align="center">Width</TD>

<TD align="center">Height</TD>

<TD align="center">No. of</TD>

</TR>

<TD><INPUT TYPE="text" NAME="l1" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="w1" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="h1" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="p1" SIZE="4" MAXLENGTH="3" onBlur="checknum(this)" value="1"></TD>

</TR>

<TD><INPUT TYPE="text" NAME="l2" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="w2" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="h2" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="p2" SIZE="4" MAXLENGTH="3" onBlur="checknum(this)" value="1"></TD>

</TR>

<TD><INPUT TYPE="text" NAME="l3" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="w3" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="h3" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="p3" SIZE="4" MAXLENGTH="3" onBlur="checknum(this)" value="1"></TD>

</TR>

<TD><INPUT TYPE="text" NAME="l4" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="w4" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="h4" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="p4" SIZE="4" MAXLENGTH="3" onBlur="checknum(this)" value="1"></TD>

</TR>

<TD><INPUT TYPE="text" NAME="l5" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="w5" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="h5" SIZE="5" MAXLENGTH="3" onBlur="checknum(this)"></TD>

<TD><INPUT TYPE="text" NAME="p5" SIZE="4" MAXLENGTH="3" onBlur="checknum(this)" value="1"></TD>

</TR>

</TABLE>

</TD>

<TR>

<TD ALIGN="center">Weight KG</TD>

<TD><INPUT TYPE="text" NAME="volumetric_weight" SIZE="5" MAXLENGTH="5" onBlur="checknum(this)" CLASS="booking_box_blank" onFocus="this.blur()" value="0">  <INPUT TYPE="BUTTON" NAME="Button" VALUE="Recalculate"></TD>

<TR>

<TD ALIGN="center">Chargeable KG</TD>

<TD ALIGN="left"><INPUT TYPE="text" NAME="chargeable_weight" SIZE="5" MAXLENGTH="5"></TD>

</TR>

</TABLE><br><br>

help would be more than appreciated..thanks 4 all

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...