A
Athmaus
Hello,
I have this ecom page that i am making where customers can select to choose
additional licenses before they purchase. I have that part working with
javascript.
Problem is that when the selection is made and you hit the add but it isn't
sending to the right pages (and i think i need to do it in another statemen
instead of a if..then, since there will be at least 16 conditions here.
<%
Response.Expires = -1000
Response.Buffer = True
If Request.Form("purchase") ="true" Then
BuyCrossSale
Else
CrossSale
End If
Sub BuyCrossSale
Dim prod2, prod3, one, two, three, tons
one = "1"
two= "2"
three = "3"
tons = "99"
prod2 = Request.Form("prod2")
prod3 = Request.Form("prod3")
If Request.Form("licenses") = one AND prod2 = "on" AND prod3 = "on" Then
Response.Redirect "http://www.msn.com"
Else
If Request.Form("licenses") = one AND prod3 = "on" Then
Response.Redirect "http://www.dogpile.com"
Else
If Request.Form("licenses") = one AND prod2 = "on" Then
Response.Redirect "http://www.google.com"
Else
If Request.Form("licenses") = one Then
Response.Redirect "http://www.google.com"
Else
Response.Redirect "http://ps2.ign.com"
CrossSale
End If
End If
End If
End If
End Sub
%>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
function UpdateTotal()
{
var product_name = "MAIN";
var regular = 0;
var saved = 0;
var total = 0;
var Ptotal = 0;
var Pregular = 0;
if(document.getElementById('frm').licenses.value == 1)
{
total += 19.99;
regular += 19.99 * 2;
}
else if(document.getElementById('frm').licenses.value == 2)
{
product_name = "MAIN x 2";
total += 29.99;
regular += 19.99 * 2 * 2;
}
else if(document.getElementById('frm').licenses.value == 3)
{
product_name = "MAIN x 3";
total += 39.99;
regular += 19.99 * 2 * 3;
}
else if(document.getElementById('frm').licenses.value == 99)
{
product_name = "MAIN Unlimited";
total += 69.99;
regular += 19.99 * 2 * 4;
}
Ptotal = total;
Pregular = regular;
if(document.getElementById('frm').prod2.checked)
{
document.getElementById("row_ap").style.display = '';
total += 9.99;
regular += 9.99;
}
else
{
document.getElementById("row_ap").style.display = 'none';
}
if(document.getElementById('frm').prod3.checked)
{
document.getElementById("row_aa").style.display = '';
total += 6.99;
regular += 39.99;
}
else
{
document.getElementById("row_aa").style.display = 'none';
}
saved = regular - total;
if(document.all) //ie
{
document.all("product_name").innerText = product_name;
document.all("product_price").innerHTML =
formatAsMoney(Ptotal).toString() + " <font size='1' color='#ffffff'
face='Verdana'><b>(<s>" + formatAsMoney(Pregular).toString() +
"</s>)</b></font>";
document.all("total_purchase").innerText = '$' +
formatAsMoney(total).toString();
}
else
{
document.getElementById("product_name").textContent = product_name;
document.getElementById("product_price").innerHTML =
formatAsMoney(Ptotal).toString() + " <font size='1' color='#ffffff'
face='Verdana'><b>(<s>" + formatAsMoney(Pregular).toString() +
"</s>)</b></font>";
document.getElementById("total_purchase").textContent = '$' +
formatAsMoney(total).toString();
}
return true;
}
function formatAsMoney(mnt)
{
mnt -= 0;
mnt = (Math.round(mnt*100))/100;
return (mnt == Math.floor(mnt)) ? mnt + '.00'
: ( (mnt*10 == Math.floor(mnt*10)) ?
mnt + '0' : mnt);
}
//-->
</script>
</head>
<body><% Sub CrossSale %>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th scope="col"> </th>
</tr>
<tr>
<td><table width="750" border="1" align="center" cellpadding="0"
cellspacing="0" bordercolor="#000000" class="bground">
<tr>
<th><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th> <form method="post" action="work.asp" target="_top"
name="frm" id="frm">
<input type="hidden" name="purchase" value="true">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="243" valign="top" align="center">
<table width="100%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td><table width="95%" border="0"
align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" class="product">Your
Current Order:</td>
</tr>
<tr>
<td><table width="95%" border="2"
align="center" cellpadding="1" cellspacing="2" bgcolor="#003364" class="para">
<!--DWLayoutTable-->
<tr>
<td width="113" align="left"
class="paraboldwhite" id="product_name">MAIN</td>
<td width="104" align="right"
class="paraboldwhite" id="product_price">19.99 <span
class="paraboldwhite2">(<s>39.99</s>)</span></td>
</tr>
<tr id="row_ap">
<td align="left"
class="paraboldwhite">PRODUCT 2 </td>
<td align="right"
class="paraboldwhite"><b>9.99 <span
class="paraboldwhite2">(<s>19.99</s>)</span></td>
</tr>
<tr id="row_aa">
<td align="left"
class="paraboldwhite">PRODUCT 3 </td>
<td align="right"
class="paraboldwhite">6.99 <span
class="paraboldwhite2">(<s>9.99</s>)</span></td>
</tr>
<tr>
<td style="padding:0px;" colspan="2"
valign="top"></td>
</tr>
<tr>
<td align="left"
class="paraboldred">Your Total:</td>
<td align="right"
class="paraboldred" id="total_purchase">$36.97</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></th>
<th width="457" valign="top"> <table width="100%"
border="0" cellpadding="0" cellspacing="0" id="AutoNumber2" class="para">
<tr>
<td colspan="2"><div align="center">
<select name="licenses" id="licenses"
onChange="return UpdateTotal();">
<option value="1">Single Computer
$19.99</option>
<option value="2">2 Computers $29.99</option>
<option value="3">3 Computers $39.99</option>
<option value="99">Unlimited Computer
License $69.99</option>
</select>
</div></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" align="left" class="para"><br>
<input name="prod2" type="checkbox" id="prod2"
onClick="return UpdateTotal();" value="ON" checked="CHECKED" />
Yes, Include PRODUCT 2<br>
<input name="prod3" type="checkbox" id="prod3" onClick="return
UpdateTotal();" value="ON" checked="CHECKED" />
Yes, Include PRODUCT 3</td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td align="left" class="para"><br>
<br>
<a value="Add" name="yes" type="submit">
<input type="submit" value="Add" name="yes">
</a></td>
</tr>
</table>
</th>
</tr>
</table>
</form>
</th>
</tr>
<tr>
<td valign="top" align="center" class="footer"> </td>
</tr>
</table></th>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
</table><% End Sub %>
Any help is greatly appreciated
I have this ecom page that i am making where customers can select to choose
additional licenses before they purchase. I have that part working with
javascript.
Problem is that when the selection is made and you hit the add but it isn't
sending to the right pages (and i think i need to do it in another statemen
instead of a if..then, since there will be at least 16 conditions here.
<%
Response.Expires = -1000
Response.Buffer = True
If Request.Form("purchase") ="true" Then
BuyCrossSale
Else
CrossSale
End If
Sub BuyCrossSale
Dim prod2, prod3, one, two, three, tons
one = "1"
two= "2"
three = "3"
tons = "99"
prod2 = Request.Form("prod2")
prod3 = Request.Form("prod3")
If Request.Form("licenses") = one AND prod2 = "on" AND prod3 = "on" Then
Response.Redirect "http://www.msn.com"
Else
If Request.Form("licenses") = one AND prod3 = "on" Then
Response.Redirect "http://www.dogpile.com"
Else
If Request.Form("licenses") = one AND prod2 = "on" Then
Response.Redirect "http://www.google.com"
Else
If Request.Form("licenses") = one Then
Response.Redirect "http://www.google.com"
Else
Response.Redirect "http://ps2.ign.com"
CrossSale
End If
End If
End If
End If
End Sub
%>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
function UpdateTotal()
{
var product_name = "MAIN";
var regular = 0;
var saved = 0;
var total = 0;
var Ptotal = 0;
var Pregular = 0;
if(document.getElementById('frm').licenses.value == 1)
{
total += 19.99;
regular += 19.99 * 2;
}
else if(document.getElementById('frm').licenses.value == 2)
{
product_name = "MAIN x 2";
total += 29.99;
regular += 19.99 * 2 * 2;
}
else if(document.getElementById('frm').licenses.value == 3)
{
product_name = "MAIN x 3";
total += 39.99;
regular += 19.99 * 2 * 3;
}
else if(document.getElementById('frm').licenses.value == 99)
{
product_name = "MAIN Unlimited";
total += 69.99;
regular += 19.99 * 2 * 4;
}
Ptotal = total;
Pregular = regular;
if(document.getElementById('frm').prod2.checked)
{
document.getElementById("row_ap").style.display = '';
total += 9.99;
regular += 9.99;
}
else
{
document.getElementById("row_ap").style.display = 'none';
}
if(document.getElementById('frm').prod3.checked)
{
document.getElementById("row_aa").style.display = '';
total += 6.99;
regular += 39.99;
}
else
{
document.getElementById("row_aa").style.display = 'none';
}
saved = regular - total;
if(document.all) //ie
{
document.all("product_name").innerText = product_name;
document.all("product_price").innerHTML =
formatAsMoney(Ptotal).toString() + " <font size='1' color='#ffffff'
face='Verdana'><b>(<s>" + formatAsMoney(Pregular).toString() +
"</s>)</b></font>";
document.all("total_purchase").innerText = '$' +
formatAsMoney(total).toString();
}
else
{
document.getElementById("product_name").textContent = product_name;
document.getElementById("product_price").innerHTML =
formatAsMoney(Ptotal).toString() + " <font size='1' color='#ffffff'
face='Verdana'><b>(<s>" + formatAsMoney(Pregular).toString() +
"</s>)</b></font>";
document.getElementById("total_purchase").textContent = '$' +
formatAsMoney(total).toString();
}
return true;
}
function formatAsMoney(mnt)
{
mnt -= 0;
mnt = (Math.round(mnt*100))/100;
return (mnt == Math.floor(mnt)) ? mnt + '.00'
: ( (mnt*10 == Math.floor(mnt*10)) ?
mnt + '0' : mnt);
}
//-->
</script>
</head>
<body><% Sub CrossSale %>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th scope="col"> </th>
</tr>
<tr>
<td><table width="750" border="1" align="center" cellpadding="0"
cellspacing="0" bordercolor="#000000" class="bground">
<tr>
<th><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th> <form method="post" action="work.asp" target="_top"
name="frm" id="frm">
<input type="hidden" name="purchase" value="true">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="243" valign="top" align="center">
<table width="100%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td><table width="95%" border="0"
align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" class="product">Your
Current Order:</td>
</tr>
<tr>
<td><table width="95%" border="2"
align="center" cellpadding="1" cellspacing="2" bgcolor="#003364" class="para">
<!--DWLayoutTable-->
<tr>
<td width="113" align="left"
class="paraboldwhite" id="product_name">MAIN</td>
<td width="104" align="right"
class="paraboldwhite" id="product_price">19.99 <span
class="paraboldwhite2">(<s>39.99</s>)</span></td>
</tr>
<tr id="row_ap">
<td align="left"
class="paraboldwhite">PRODUCT 2 </td>
<td align="right"
class="paraboldwhite"><b>9.99 <span
class="paraboldwhite2">(<s>19.99</s>)</span></td>
</tr>
<tr id="row_aa">
<td align="left"
class="paraboldwhite">PRODUCT 3 </td>
<td align="right"
class="paraboldwhite">6.99 <span
class="paraboldwhite2">(<s>9.99</s>)</span></td>
</tr>
<tr>
<td style="padding:0px;" colspan="2"
valign="top"></td>
</tr>
<tr>
<td align="left"
class="paraboldred">Your Total:</td>
<td align="right"
class="paraboldred" id="total_purchase">$36.97</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></th>
<th width="457" valign="top"> <table width="100%"
border="0" cellpadding="0" cellspacing="0" id="AutoNumber2" class="para">
<tr>
<td colspan="2"><div align="center">
<select name="licenses" id="licenses"
onChange="return UpdateTotal();">
<option value="1">Single Computer
$19.99</option>
<option value="2">2 Computers $29.99</option>
<option value="3">3 Computers $39.99</option>
<option value="99">Unlimited Computer
License $69.99</option>
</select>
</div></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" align="left" class="para"><br>
<input name="prod2" type="checkbox" id="prod2"
onClick="return UpdateTotal();" value="ON" checked="CHECKED" />
Yes, Include PRODUCT 2<br>
<input name="prod3" type="checkbox" id="prod3" onClick="return
UpdateTotal();" value="ON" checked="CHECKED" />
Yes, Include PRODUCT 3</td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td align="left" class="para"><br>
<br>
<a value="Add" name="yes" type="submit">
<input type="submit" value="Add" name="yes">
</a></td>
</tr>
</table>
</th>
</tr>
</table>
</form>
</th>
</tr>
<tr>
<td valign="top" align="center" class="footer"> </td>
</tr>
</table></th>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
</table><% End Sub %>
Any help is greatly appreciated