File: D:/web/homefly/vsadmin/inc/incuspsmeths.asp
<%
'This code is copyright (c) Internet Business Solutions SL, all rights reserved.
'The contents of this file are protect under law as the intellectual property
'of Internet Business Solutions SL. Any use, reproduction, disclosure or copying
'of any kind without the express and written permission of Internet Business
'Solutions SL is forbidden.
'Author: Vince Reid, vince@virtualred.net
if Session("loggedon") <> "virtualstore" then response.end
Dim sSQL,rs,success,cnn,errmsg,index,allcountries
success=true
Set rs = Server.CreateObject("ADODB.RecordSet")
Set cnn=Server.CreateObject("ADODB.Connection")
cnn.open sDSN
sSQL = "SELECT adminShipping FROM admin WHERE adminID=1"
rs.Open sSQL,cnn,0,1
shipType = Int(rs("adminShipping"))
rs.Close
if request.form("posted")="1" then
if shipType=3 then
for index=1 to 25
if Trim(request.form("methodshow"&index))<>"" then
sSQL = "UPDATE uspsMethods SET uspsShowAs='"&replace(request.form("methodshow"&index),"'","''")&"',"
if request.form("methoduse"&index)="ON" then
sSQL = sSQL & "uspsUseMethod=1 WHERE uspsID="&index
else
sSQL = sSQL & "uspsUseMethod=0 WHERE uspsID="&index
end if
cnn.Execute(sSQL)
end if
next
elseif shipType=4 then
for index=100 to 125
if Trim(request.form("methodshow"&index))<>"" then
sSQL = "UPDATE uspsMethods SET "
if request.form("methoduse"&index)="ON" then
sSQL = sSQL & "uspsUseMethod=1 WHERE uspsID="&index
else
sSQL = sSQL & "uspsUseMethod=0 WHERE uspsID="&index
end if
cnn.Execute(sSQL)
end if
next
end if
response.write "<meta http-equiv=""refresh"" content=""3; url=admin.asp"">"
else
sSQL = "SELECT uspsID,uspsMethod,uspsShowAs,uspsUseMethod,uspsLocal FROM uspsMethods "
if shipType=3 then
sSQL = sSQL & " WHERE uspsID < 100"
elseif shipType=4 then
sSQL = sSQL & " WHERE uspsID > 100 AND uspsID < 200"
end if
sSQL = sSQL & " ORDER BY uspsLocal DESC, uspsID"
rs.Open sSQL,cnn,0,1
allmethods=rs.getrows
rs.Close
end if
cnn.Close
%>
<table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
<% if shipType<>3 AND shipType<>4 then %>
<tr>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
<tr>
<td width="100%" colspan="2" align="center"><br><b>This page only applies to UPS and USPS shipping type. Please
choose one of these shipping types on the admin main page.<br>
<br>
<img src="../images/clearpixel.gif" width="350" height="1">
</td>
</tr>
</table></td>
</tr>
<% elseif request.form("posted")="1" AND success then %>
<tr>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
<tr>
<td width="100%" colspan="2" align="center"><br><b>Update Successful !</b><br><br>You will now be forwarded
to the admin home page.<br><br>
If that does not happen automatically then please <A href="admin.asp"><b>click
here</b></a>.<br>
<br>
<img src="../images/clearpixel.gif" width="350" height="1">
</td>
</tr>
</table></td>
</tr>
<% else %>
<tr>
<form method="POST" action="adminuspsmeths.asp">
<td width="100%">
<input type="hidden" name="posted" value="1">
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
<tr>
<td width="100%" colspan="4" align="center"><br><b>Use this page to update your U<%if shipType=3 then response.write "S"%>PS shipping methods.</b><br> </td>
</tr>
<% if not success then %>
<tr>
<td width="100%" colspan="4" align="center"><br><font color="#FF0000"><%=errmsg%></font>
</td>
</tr>
<% end if %>
<% if shipType=3 then %>
<tr>
<td colspan="4"><ul><li><font size="1">The USPS shipping interface will only display shipping methods
that are valid for your product weight. However, they will not check product dimensions so you
must make sure your products can be shipped via the selected methods. If in doubt just leave the default
Parcel Post methods.</li><li><font size="1">More details about shipping with USPS can be found at their site at
<a href="http://www.usps.com">http://www.usps.com</a>.</font></li></ul></td>
</tr>
<% for index=0 to UBOUND(allmethods,2) %>
<tr>
<td align="right">USPS Method:</td>
<td align="left"><font size="1"><%=allmethods(1,index)%></font></td>
<td align="right">Use Method:</td>
<td align="left"><input type="checkbox" name="methoduse<%=allmethods(0,index)%>" value="ON" <% if Int(allmethods(3,index))=1 then response.write "checked"%>></td>
</tr>
<tr>
<td align="right">Show As:</td>
<td align="left"><input type="text" name="methodshow<%=allmethods(0,index)%>" value="<%=allmethods(2,index)%>" size="36"></td>
<td align="right">Type:</td>
<td align="left"><%if Int(allmethods(4,index))=1 then response.write "Domestic" else response.write "Internat."%></td>
</tr>
<tr>
<td colspan="4" align="center"><hr width="80%"></td>
</tr>
<% next %>
<% else %>
<tr>
<td colspan="4"><ul><li><font size="1">You can use this page to limit UPS Shipping to certain shipping methods.</li>
<li><font size="1">More details about shipping with UPS can be found at their site at
<a href="http://www.ups.com">http://www.ups.com</a>.</font></li></ul></td>
</tr>
<% for index=0 to UBOUND(allmethods,2) %>
<tr>
<input type="hidden" name="methodshow<%=allmethods(0,index)%>" value="1">
<td align="right"><b>UPS Method:</b></td>
<td align="left"> <%=allmethods(2,index)%></td>
<td align="right"><b>Use Method:</b></td>
<td align="left"><input type="checkbox" name="methoduse<%=allmethods(0,index)%>" value="ON" <% if Int(allmethods(3,index))=1 then response.write "checked"%>></td>
</tr>
<tr>
<td colspan="4" align="center"><hr width="80%"></td>
</tr>
<% next %>
<% end if %>
<tr>
<td width="100%" colspan="4" align="center"><br><input type="submit" value="Submit"><br> </td>
</tr>
</table></td>
</form>
</tr>
<% end if %>
</table>