Hjælp til E-Shop!
Hej!Jeg har en STORE problem for mig, som jeg ikke selv er i stand til at løse ;o)
Jeg har påtaget mig at tilpasse en web-shop til en kammerat (gratis) men til min skræk ser jeg en fejl nu hvor shoppen kører!
Problemet er, at når folk handler i shoppen uden at være oprettet som kunde ligge den ikke fragten til efter de har oprettet som kunde og afgiv ordren.
Jeg tror problemet ligger formularet, hvor de opretter sig som kunde - den husker at undtag portoen..............
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/CharonCart.asp" -->
<!--#include file="functions.asp" -->
<%
Dim CustomerRS__value
CustomerRS__value = "qq"
if (Request("CustomerEmail") <> "") then CustomerRS__value = Request("CustomerEmail")
%>
<%
set CustomerRS = Server.CreateObject("ADODB.Recordset")
CustomerRS.ActiveConnection = MM_CharonCart_STRING
CustomerRS.Source = "SELECT * FROM Customers WHERE customeremail='" + Replace(CustomerRS__value, "'", "''") + "'"
CustomerRS.CursorType = 0
CustomerRS.CursorLocation = 2
CustomerRS.LockType = 3
CustomerRS.Open()
CustomerRS_numRows = 0
%>
<%
If (CStr(Request("selected")) <> "") Then
if not CustomerRS.eof then response.redirect "NewUserTaken.asp"
strFn=cstr(Request("FirstName"))
Response.Cookies("firstname").Expires=Date + 365
response.cookies("firstname")=ucase(left(strFn,1)) & right(strFn,len(strFn)-1)
if Request.Form("RememberMe") = "check" then
Response.Cookies("username").Expires=Date + 365
Response.Cookies("pass").Expires=Date + 365
Response.Cookies("rememberme").Expires=Date + 365
response.cookies("username")=Request("CustomerEmail")
response.cookies("pass")=Request("Password")
response.cookies("rememberme")=Request("RememberMe")
end if
CustomerRS.addnew
CustomerRS("Title")=Request("Title")
CustomerRS("LastName")=Request("LastName")
CustomerRS("FirstName")=Request("FirstName")
CustomerRS("CustomerEmail")=Request("CustomerEmail")
CustomerRS("CustomerPassword")=Request("CustomerPassword")
CustomerRS("BillingAddress1")=Request("BillingAddress1")
CustomerRS("BillingCity")=Request("BillingCity")
CustomerRS("BillingPostalCode")=Request("BillingPostalCode")
CustomerRS("BillingCountry")=Request("BillingCountry")
CustomerRS("SameDelivery")=DoCheck(Request("SameDelivery"))
CustomerRS("DeliveryAddress1")=Request("DeliveryAddress1")
CustomerRS("ShipCity")=Request("ShipCity")
CustomerRS("ShipPostalCode")=Request("ShipPostalCode")
CustomerRS("ShipCountry")=Request("ShipCountry")
CustomerRS("Phone")=Request("Phone")
CustomerRS("Fax")=Request("Fax")
CustomerRS("MailingList")=DoCheck(Request("MailingList"))
CustomerRS.update
CustomerRS.requery
Response.Cookies("Products")("CustomerID")=CustomerRS("CustomerID")
Response.Redirect("checkout.asp")
end if
%>
<%
set CountyRS = Server.CreateObject("ADODB.Recordset")
CountyRS.ActiveConnection = MM_CharonCart_STRING
CountyRS.Source = "SELECT * FROM Counties"
CountyRS.CursorType = 0
CountyRS.CursorLocation = 2
CountyRS.LockType = 3
CountyRS.Open()
CountyRS_numRows = 0
%>
<%
set CountryRS = Server.CreateObject("ADODB.Recordset")
CountryRS.ActiveConnection = MM_CharonCart_STRING
CountryRS.Source = "SELECT * FROM Countries"
CountryRS.CursorType = 0
CountryRS.CursorLocation = 2
CountryRS.LockType = 3
CountryRS.Open()
CountryRS_numRows = 0
%>
<%
set Titles = Server.CreateObject("ADODB.Recordset")
Titles.ActiveConnection = MM_CharonCart_STRING
Titles.Source = "SELECT * FROM Titles"
Titles.CursorType = 0
Titles.CursorLocation = 2
Titles.LockType = 3
Titles.Open()
Titles_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
BoardRS_numRows = BoardRS_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Repeat2__numRows = -1
Dim Repeat2__index
Repeat2__index = 0
MemberRS_numRows = MemberRS_numRows + Repeat2__numRows
%>
<html>
<head>
<title>New User</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
<!--
function copytext() {
if (document.form1.SameDelivery.checked) {
document.form1.DeliveryAddress1.value=document.form1.BillingAddress1.value
document.form1.ShipCity.value=document.form1.BillingCity.value
document.form1.ShipPostalCode.value=document.form1.BillingPostalCode.value
document.form1.ShipCountry.value=document.form1.BillingCountry.value
}
else {
document.form1.DeliveryAddress1.value=""
document.form1.ShipCity.value=""
document.form1.ShipPostalCode.value=""
document.form1.ShipCountry.value=""
}
}
function cp() {
var cperr=''
if (document.form1.CustomerPassword.value != document.form1.Confirm.value) { cperr += 'Please confirm password' }
if (cperr !='') { alert(cperr) }
document.MM_returnValue2 = (cperr=='')
}
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' skal være en gyldig Emailadresse.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' skal indtastes.\n'; }
} if (errors) alert('Følgende fejl opstod:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
<link rel="stylesheet" href="Styles.css">
</head>
<body bgcolor="#FFFFFF" >
<div id="content">
<h1 id="pageName">Registrering</h1> <br>
<a href="java script:history.go(-1);"><< Tilbage</a>
<div class="story">
<form action="NewUser.asp" method="post" name="form1" onSubmit="MM_validateForm('FirstName','','R','LastName','','R','CustomerEmail','','RisEmail','CustomerPassword','','R');return document.MM_returnValue">
<table width="80%" border=0 align="center" cellpadding="3" bordercolor="navy">
<tr class="para">
<td height="21" colspan=2 valign=TOP> <h5>Kunde Information</h5></td>
</tr>
<tr valign="middle" class="para">
<td class="story">Titel</td>
<td width="404" colspan="-1" class="story">
<select name="Title" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" class="textbox">
<%
While (NOT Titles.EOF)
%>
<option value="<%=(Titles.Fields.Item("Title").Value)%>"><%=(Titles.Fields.Item("Title").Value)%></option>
<%
Titles.MoveNext()
Wend
%>
</select> </td>
</tr>
<tr valign="middle" class="para">
<td class="story">Fornavn</td>
<td width=404 colspan="-1" class="story">
<input name="FirstName" type="text" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2 class="story">
<input name="LastName" type="text" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Efternavn</td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2 class="story">
<input name="BillingAddress1" type="text" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Addresse </td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2 class="story">
<input name="BillingPostalCode" type="text" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Post nr </td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2 class="story">
<input name="BillingCity" type="text" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">By</td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2 class="story">
<input name="BillingCountry" type="hidden" id="BillingCountry" value="Denmark">
<input name="textfield" type="text" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="Danmark"></td>
</tr>
<tr valign="middle" class="para">
<td class="story">Land</td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2 class="story">
<input name="CustomerEmail" type="text" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Email Addresse</td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2 class="story">
<input name="Phone" type="text" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Telefon</td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2 class="story">
<input name="FAX" type="text" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Telefax</td>
</tr>
<tr valign="middle" class="para">
<td colspan=2>
<h5><br>
Forsendelses Information<br>
<br>
</h5></td>
</tr>
<tr valign="middle" class="para">
<td colspan="2" class="story"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<input name="SameDelivery" type="CheckBox" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" id="SameDelivery" onClick="MM_callJS('copytext()')" value="1" >
</font> Ja, leverings adressen er den samme som kunde adressen.<br>
</td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2>
<input name="DeliveryAddress1" type="text" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Lev. Addresse</td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2>
<input name="ShipCity" type="text" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Lev. By</td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2>
<input name="ShipPostalCode" type="text" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Lev. Post nr</td>
</tr>
<tr valign="middle" class="para">
<td></td>
<td width=404 colspan="-1" rowspan=2>
<input name="ShipCountry" type="hidden" id="ShipCountry">
<input name="textfield2" type="text" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="Danmark"></td>
</tr>
<tr valign="middle" class="para">
<td class="story">Lev. Land</td>
</tr>
<tr valign="middle" class="para">
<td colspan=2>
<h5><br>
Skriv et password og bekræft det nedenunder</h5></td>
</tr>
<tr valign="middle" class="para">
<td class="story">Password</td>
<td width=404 colspan="-1">
<input name="CustomerPassword" type="PASSWORD" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" id="CustomerPassword" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Bekræft</td>
<td width=404 colspan="-1">
<input name="Confirm" type="PASSWORD" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="" size="45" maxlength=100>
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Husk mit Password </td>
<td width=404 colspan="-1">
<input name="RememberMe" type="checkbox" class="textbox" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="check">
</td>
</tr>
<tr valign="middle" class="para">
<td class="story">Tilmeld til nyhedsemail</td>
<td colspan="-1">
<input name="MailingList" type="checkbox" id="MailingList" onfocus="this.style.backgroundColor='#c5c5c5';" onblur="this.style.backgroundColor='#ffffff';" value="1">
</td>
</tr>
<tr valign="middle" class="para">
<td> </td>
<td width=404 colspan="-1">
<input type="submit" name="Submit" value="Gem" onClick="cp();return document.MM_returnValue2">
<input name="selected" type="hidden" id="selected" value="1"> </td>
</tr>
</table>
</form>
<h3> </h3>
</div>
<div class="story"></div>
</div>
<!--#include file="footer.asp" -->
</body>
</html>
<%
CustomerRS.Close()
%>
<%
CountyRS.Close()
%>
<%
CountryRS.Close()
%>
<%
Titles.Close()
%>
