-
Need assistance in sending info to 2 places (ASP/Javascript)
OK, so the situation is briefly as follows, in the shopping cart, it was sending the info to the gateway and the gateway would send an e-mail with all the info for the order, or so I thought. Due to char restrictions it wasn't sending all of the actual order info. So I tried to get the information sent to both the gateway and in an e-mail, it's sending the info to the gateway, and sending me the e-mail, but it's not pulling the data through. Any assistance would be greatly appreciated.
Code I was using to pull the e-mail is as follows:
<%
Dim order_id
Dim total
Dim quantity1
Dim number1
Dim item1
Dim option1
Dim price1
EmailFrom = "Palmetto Website"
EmailTo = "jimmiller@agelessimagination.com"
Subject = "Completed Order"
ID = Trim(Request.Form("order_id"))
Amount = Trim(Request.Form("total"))
Order = Trim(Request.form("quantity1") & Request.form("number1") & Request.form("item1") & Request.form("option1")& Request.form("price1")& vbcrlf&_
Request.form("quantity2") & Request.form("number2") & Request.form("item2") & Request.form("option2")& Request.form("price2")& vbcrlf&_
(repeats to 30) )
Dim Body
Body = Body & "ID: " & ID & VbCrLf
Body = Body & "Total: " & total & VbCrLf
Body = Body & "Order: " & order & VbCrLf
Dim objAspEmail
Set objAspEmail = Server.CreateObject("Persits.MailSender")
objAspEmail.AddAddress EmailTo
objAspEmail.From = EmailFrom
objAspEmail.Subject = Subject
objAspEmail.Body = Body
objAspEmail.Host = "mail.palmettofireworks.com"
objAspEmail.Send
%>
Now as I said, I get the e-mail, but the only thing in it is:
ID:
Total:
Order:
So I'm doing something wrong here, but not sure quite what it is, but I'm positive I'll probably smack myself when it's pointed out.
Thanks,
Vyktor
-
OK, guessing that info wasn't enough, this is the code for the whole page minus the color variables and whatnot since those aren't the problem:
<!-- #INCLUDE FILE="settings.asp" -->
<form onSubmit="return form_validator(this)" action="secure/sim.asp" method=post>
<%
Dim order_id
Dim total
Dim quantity1
Dim number1
Dim item1
Dim option1
Dim price1
EmailFrom = "Palmetto Website"
EmailTo = "jimmiller@agelessimagination.com"
Subject = "Completed Order"
ID = Trim(Request.Form("order_id"))
Amount = Trim(Request.Form("total"))
Order = Trim(Request.form("quantity1") & Request.form("number1") & Request.form("item1") & Request.form("option1")& Request.form("price1")& vbcrlf&_
Request.form("quantity2") & Request.form("number2") & Request.form("item2") & Request.form("option2")& Request.form("price2")& vbcrlf&_
Request.form("quantity3") & Request.form("number3") & Request.form("item3") & Request.form("option3")& Request.form("price3")& vbcrlf&_
(goes to 30)
Dim Body
Body = Body & "ID: " & order_ID & VbCrLf
Body = Body & "Total: " & total & VbCrLf
Body = Body & "Order: " & quantity1 & VbCrLf
Dim objAspEmail
Set objAspEmail = Server.CreateObject("Persits.MailSender")
objAspEmail.AddAddress EmailTo
objAspEmail.From = EmailFrom
objAspEmail.Subject = Subject
objAspEmail.Body = Body
objAspEmail.Host = "mail.palmettofireworks.com"
objAspEmail.Send
%>
<%
Function RandNo()
Randomize
RandNo = Int(99999999 * Rnd + 3)
End Function
%>
<INPUT TYPE="hidden" NAME="order_id" VALUE="<%=RandNo()%>" SIZE="40">
<script LANGUAGE="JavaScript">
function alterError(value) {
if (value<=0.99) {
newPounds = '0';
} else {
newPounds = parseInt(value);
}
newPence = parseInt((value+.0008 - newPounds)* 100);
if (eval(newPence) <= 9) newPence='0'+newPence;
newString = newPounds + '.' + newPence;
return (newString);
}
// showItems in orderform
function showItems() {
index = document.cookie.indexOf("TheBasket");
countbegin = (document.cookie.indexOf("=", index) + 1);
countend = document.cookie.indexOf(";", index);
if (countend == -1) {
countend = document.cookie.length;
}
fulllist = document.cookie.substring(countbegin, countend);
subtotal = 0;
subweight = 0;
document.writeln('<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=2>');
document.writeln('<TR><TD BGCOLOR="#000000"><font size="-2" face="Arial Black"><b><%=txt_qty%></b></FONT></TD><TD BGCOLOR="#000000"><font size="-2" face="Arial Black"><b><%=txt_art_no%></b></FONT></TD><TD BGCOLOR="#000000"><font size="-2" face="Arial Black"><b><%=txt_item%></b></FONT></TD><TD BGCOLOR="#000000"><font size="-2" face="Arial Black"><b><%=txt_option%></b></FONT></TD><TD BGCOLOR="#000000"><font size="-2" face="Arial Black"><b><%=txt_price%></b></FONT></TD><td BGCOLOR="#000000"><font size="-2" face="Arial Black"><b><%=txt_sub_total%></b></FONT></td></TR>');
itemlist = 0;
for (var i = 0; i <= fulllist.length; i++) {
if (fulllist.substring(i,i+1) == '[') {
thisitem = 1;
itemstart = i+1;
} else if (fulllist.substring(i,i+1) == ']') {
itemend = i;
thequantity = fulllist.substring(itemstart, itemend);
itemtotal = 0;
itemtotal = (eval(theprice*thequantity));
temptotal = itemtotal * 100;
subtotal = subtotal + itemtotal;
weighttotal = 0;
weighttotal = (eval(theweight*thequantity));
subweight = subweight + weighttotal;
itemlist=itemlist+1;
document.write('<tr><td align=middle BGCOLOR="#000000"><font size="-2" face="Arial Black">'+thequantity+'</FONT></td>');
document.writeln('<td BGCOLOR="#000000"><font size="-2" face="Arial Black">'+thenumber+'</FONT></td><td align=left BGCOLOR="#000000"><font size="-2" face="Arial Black">'+theitem+'</FONT></td><td align=left BGCOLOR="#000000"><font size="-2" face="Arial Black">'+theoption+' '+theoption2+'</FONT></td><td align=right BGCOLOR="#000000"><font size="-2" face="Arial Black">'+theprice+'</FONT></td><td align=right BGCOLOR="#000000"><font size="-2" face="Arial Black">'+alterError(itemtotal)+'</FONT></td></tr>');
document.writeln('<INPUT TYPE="hidden" NAME="quantity'+itemlist+'" VALUE="'+thequantity+' x" SIZE="40">');
document.writeln('<INPUT TYPE="hidden" NAME="number'+itemlist+'" VALUE=" '+thenumber+'" SIZE="40">');
document.writeln('<INPUT TYPE="hidden" NAME="item'+itemlist+'" VALUE=" '+theitem+'" SIZE="80">');
document.writeln('<INPUT TYPE="hidden" NAME="price'+itemlist+'" VALUE=" '+theprice+'" SIZE="40">');
document.writeln('<INPUT TYPE="hidden" NAME="totalcost'+itemlist+'" VALUE="'+alterError(itemtotal)+'" SIZE="40">');
document.writeln('<INPUT TYPE="hidden" NAME="option'+itemlist+'" VALUE=" '+theoption+' '+theoption2+'" SIZE="80">');
} else if (fulllist.substring(i,i+1) == '|') {
if (thisitem==1) theitem = fulllist.substring(itemstart, i);
if (thisitem==2) theprice = fulllist.substring(itemstart, i);
if (thisitem==3) thenumber = fulllist.substring(itemstart, i);
if (thisitem==4) theoption = fulllist.substring(itemstart, i);
if (thisitem==5) theoption2 = fulllist.substring(itemstart, i);
if (thisitem==6) theweight = fulllist.substring(itemstart, i);
thisitem++;
itemstart=i+1;
}
}
totprice = (Math.round(subtotal*100)/100);
shipping = (subweight*<%=add_shipping%>)+0.00;
totalcost = (totprice+shipping);
tax = (Math.round(totalcost*<%=add_tax%>)/100);
document.writeln('<tr><td align=right BGCOLOR="#000000" colspan=5><font size="-2" face="Arial Black"><b><%=txt_sub_total%></b></FONT></td><td align=right BGCOLOR="#000000"><font size="-2" face="Arial Black">'+alterError(totprice)+'</FONT></td></tr>');
document.writeln('<tr><td align=right BGCOLOR="#000000" colspan=5><font size="-2" face="Arial Black"><b>Shipping:</b></FONT></td><td align=right BGCOLOR="#000000"><font size="-2" face="Arial Black">$0.00</FONT></td></tr>');
<%if add_tax > "1" then%>
document.writeln('<tr><td align=right BGCOLOR="#000000" colspan=5><font size="-2" face="Arial Black"><b>Tax</b></FONT></td><td align=right BGCOLOR="#000000"><font size="-2" face="Arial Black">'+alterError(tax)+'</FONT></td></tr>');
<% end if %>
document.writeln('<tr><td align=right BGCOLOR="#000000" colspan=5><font size="-2" face="Arial Black"><b><%=txt_total%></b></FONT></td><td align=right BGCOLOR="#000000"><font size="-2" face="Arial Black">'+alterError(totalcost+tax)+'</FONT></td></tr>');
document.writeln('<INPUT TYPE="hidden" NAME="total" VALUE="'+alterError(totalcost+tax)+'" SIZE="40">');
document.writeln('</TABLE>');
document.writeln('I agree with the total charges <INPUT TYPE="checkbox" NAME="x_amount" VALUE="'+alterError(totalcost+tax)+'">');
document.writeln('<input type="hidden" name="x_description" value=" '+fulllist+'">');
}
</script>
<center><font size="5" face="Arial Black"><b><%=txt_order_form%></B></FONT></center>
<HR WIDTH=75% size=1 COLOR="#000000">
<CENTER>
<script LANGUAGE="JavaScript">
showItems();
</script></CENTER>
<div align="center"> </div>
<TR>
<TD ALIGN=center COLSPAN=2> <p>
<input type="checkbox" name="tacaccept" value="checkbox">
I have read and accepted the <a href="tac.asp" target="_blank">Terms
and Conditions.</a></p>
<p><INPUT TYPE=submit NAME=Submit VALUE="<%=txt_continue%>" style="font-family: Verdana, Geneva, Helvetica; font-weight: regular; font-style: regular; font-size: 10px; color: #000000; height:20px">
<INPUT TYPE=reset VALUE="<%=txt_reset%>" style="font-family: Verdana, Geneva, Helvetica; font-weight: regular; font-style: regular; font-size: 10px; color: #000000; height:20px">
</form></form>
</p></TD>
</TR>
</TABLE>
</FONT>
</CENTER>
</BODY>
</HTML>
Now the javascript that send to the gateway page (secure/sim.asp) is working fine, the ASP part that send the e-mail off sends the e-mail but doesn't include the order info....
I've never tried to send the info two places at once and I'm not sure what it is I did wrong, any help would be greatly appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks