File: D:/web/homefly/inc/incproddetail.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
Dim sSQL,rs,alldata,useEuro,cnn,rowcounter,iNumOfPages,CurPage,Count,sectionName,weburl,longdesc,aOption()
netnav = true
if instr(Request.ServerVariables("HTTP_USER_AGENT"), "compatible") > 0 OR instr(Request.ServerVariables("HTTP_USER_AGENT"), "Gecko") > 0 then netnav = false
function atb(size)
if netnav then
atb = CInt(size / 2 + 1)
else
atb = size
end if
end function
Redim aOption(2,maxprodopts)
Count=0
Set rs = Server.CreateObject("ADODB.RecordSet")
Set rs2 = Server.CreateObject("ADODB.RecordSet")
Set cnn=Server.CreateObject("ADODB.Connection")
cnn.open sDSN
sSQL = "SELECT countryLCID,countryCurrency,countryTax,adminStockManage,adminSubCats,currRate1,currSymbol1,currRate2,currSymbol2,currRate3,currSymbol3,currConvUser,currConvPw,currLastUpdate FROM admin INNER JOIN countries ON admin.adminCountry=countries.countryID WHERE adminID=1"
rs.Open sSQL,cnn,0,1
countryCurrency = rs("countryCurrency")
useEuro = (countryCurrency="EUR")
useStockManagement = rs("adminStockManage")<>0
subCats=(Int(rs("adminSubCats"))=1)
if rs("countryLCID")<>0 then Session.LCID = rs("countryLCID")
countryTax=cDbl(rs("countryTax"))
currRate1=cDbl(rs("currRate1"))
currSymbol1=trim(rs("currSymbol1"))
currRate2=cDbl(rs("currRate2"))
currSymbol2=trim(rs("currSymbol2"))
currRate3=cDbl(rs("currRate3"))
currSymbol3=trim(rs("currSymbol3"))
currConvUser=rs("currConvUser")
currConvPw=rs("currConvPw")
currLastUpdate=rs("currLastUpdate")
rs.Close
Call checkCurrencyRates(currConvUser,currConvPw,currLastUpdate,currRate1,currSymbol1,currRate2,currSymbol2,currRate3,currSymbol3)
sSQL = "SELECT sectionName,sectionID,topSection FROM sections INNER JOIN products ON products.pSection=sections.sectionID WHERE pID='"&request.querystring("prod")&"'"
rs.Open sSQL,cnn,0,1
topSection=""
if NOT rs.EOF then
sectionName = rs("sectionName")
sectionID = rs("sectionID")
topSection = rs("topSection")
end if
rs.Close
if subCats AND topSection<>"" then
sSQL = "SELECT tsName,tsID FROM topsections WHERE tsID="&topSection
rs.Open sSQL,cnn,0,1
tsName = rs("tsName")
tsID = rs("tsID")
rs.Close
end if
sSQL = "SELECT pId,pName,pImage,pPrice,pSection,pListPrice,pSell,pInStock,pLargeImage,topSection,pDescription,pLongDescription FROM products LEFT OUTER JOIN sections ON products.pSection=sections.sectionID WHERE pId='"&Replace(Trim(request.querystring("prod")),"'","''")&"'"
rs.Open sSQL,cnn,0,1,&H0001
saveLCID = Session.LCID
prodoptions=""
productdisplayscript(true)
updatepricescript(true) %>
<table border="0" cellspacing="<%=maintablespacing%>" cellpadding="<%=maintablepadding%>" width="<%=maintablewidth%>" bgcolor="<%=maintablebg%>" align="center">
<tr>
<td width="100%">
<form method="POST" name="tForm<%=Count%>" action="cart.asp" onSubmit="return formvalidator<%=Count%>(this)">
<% if IsEmpty(showcategories) OR showcategories=true then %>
<table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td colspan="3" align="<%=headeralign%>"><b><a href="<%=xxHomeURL%>"><%=xxHome%></a>
<% if subCats then response.write "» <a href=""categories.asp?id="&tsID&""">"&tsName & "</a> " %>
» <a href="products.asp?id=<%=sectionID%>"><% =sectionName %></a></b><br>
<img src="images/clearpixel.gif" width="350" height="8"></td>
<td align="right"> <% if nobuyorcheckout<>true then %><a href="cart.asp"><img src="images/checkout.gif" border="0"></a><% end if %></td>
</tr>
</table>
<% end if
Session.LCID = 1033
tdt = Date()
sSQL = "SELECT DISTINCT cpnWorkingName FROM coupons LEFT OUTER JOIN cpnAssign ON coupons.cpnID=cpnAssign.cpaCpnID WHERE cpnNumAvail>0 AND cpnEndDate>="&datedelim&DatePart("m",tdt) & "/" & DatePart("d",tdt) & "/" & DatePart("yyyy",tdt)&datedelim&" AND cpnIsCoupon=0 AND "
sSQL = sSQL & "((cpnSitewide=1 OR cpnSitewide=2) "
sSQL = sSQL & "OR (cpnSitewide=0 AND cpaType=2 AND cpaAssignment='"&rs("pID")&"') "
sSQL = sSQL & "OR (cpnSitewide=0 AND cpaType=1 AND cpaAssignment='"&rs("pSection")&"') "
if subCats then sSQL = sSQL & "OR (cpnSitewide=0 AND cpaType=0 AND cpaAssignment='"&rs("topSection")&"')"
sSQL = sSQL & ")"
Session.LCID = saveLCID
alldiscounts = ""
rs2.Open sSQL,cnn,0,1
do while NOT rs2.EOF
alldiscounts = alldiscounts & rs2("cpnWorkingName") & "<br>"
rs2.MoveNext
loop
rs2.Close
%>
<% if usedetailbodyformat=1 OR usedetailbodyformat="" then %>
<table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td width="100%" colspan="4">
<p><% if showproductid=true then response.write "<b>" & xxPrId & ":</b> " & rs("pID") & "<br>" %><b><%=rs("pName")&xxDot%></b><% if alldiscounts<>"" then response.write " <font color=""#FF0000""><strong>"&xxDsApp&"</strong><br><font size=""1"">" & alldiscounts & "</font></font>" %></p>
</td>
</tr>
<tr>
<td width="100%" colspan="4" align="center" valign="middle"> <% if NOT (Trim(rs("pLargeImage"))="" OR IsNull(rs("pLargeImage")) OR Trim(rs("pLargeImage"))="prodimages/") then %>
<img src="<%=rs("pLargeImage")%>" border="0" alt="<%=Replace(rs("pName"),"""",""")%>"> <% elseif NOT (Trim(rs("pImage"))="" OR IsNull(rs("pImage")) OR Trim(rs("pImage"))="prodimages/") then %>
<img src="<%=rs("pImage")%>" border="0" alt="<%=Replace(rs("pName"),"""",""")%>"> <% else %> <% end if %>
</td>
</tr>
<tr>
<td width="100%" colspan="4">
<p><% shortdesc = Trim(rs("pDescription"))
longdesc = Trim(rs("pLongDescription"))
if longdesc<>"" then
response.write longdesc
elseif shortdesc<>"" then
response.write shortdesc
else
response.write " "
end if %></p>
<p align="center">
<%
if IsArray(prodoptions) then
response.write "<table border='0' cellspacing='1' cellpadding='1' width='100%'>"
for rowcounter=0 to UBOUND(prodoptions,2)
index=0
gotSelection=false
do while index < (maxprodopts-1) AND aOption(0,index)<>0
if aOption(0,index)=Int(prodoptions(0,rowcounter)) then
gotSelection=true
exit do
end if
index = index + 1
loop
if NOT gotSelection then
sSQL="SELECT optID,optName,optGrpName,optPriceDiff,optType FROM options INNER JOIN optionGroup ON options.optGroup=optionGroup.optGrpID WHERE optGroup="&prodoptions(0,rowcounter)&" ORDER BY optID"
rs2.Open sSQL,cnn,0,1
if NOT rs2.EOF then
if Abs(Int(rs2("optType")))=3 then
fieldHeight = cInt((cDbl(rs2("optPriceDiff"))-Int(rs2("optPriceDiff")))*100.0)
aOption(1,index) = "<tr><td align='right' width='30%'><b>"&rs2("optGrpName")&":</b></td><td> <input type='hidden' name='optnPLACEHOLDER' value='"&rs2("optID")&"'>"
if fieldHeight<>1 then
aOption(1,index) = aOption(1,index) & "<textarea wrap='virtual' name='voptnPLACEHOLDER' cols='"&atb(Int(rs2("optPriceDiff")))&"' rows='"&fieldHeight&"'>"
aOption(1,index) = aOption(1,index) & rs2("optName")&"</textarea>"
else
aOption(1,index) = aOption(1,index) & "<input maxlength='255' type='text' name='voptnPLACEHOLDER' size='"&atb(Int(rs2("optPriceDiff")))&"' value="""&Replace(rs2("optName"),"""",""")&""">"
end if
aOption(1,index) = aOption(1,index) & "</td></tr>"
else
aOption(1,index) = "<tr><td align='right' width='30%'><b>"&rs2("optGrpName")&":</b></td><td> <select onChange='updatepricePLACEHOLDER();' name='optnPLACEHOLDER' size='1'>"
if Int(rs2("optType"))>0 then aOption(1,index) = aOption(1,index) & "<option value=''>"&xxPlsSel&"</option>"
do while not rs2.EOF
aOption(1,index) = aOption(1,index) & "<option value='"&rs2("optID")&"'>"&rs2("optName")
if cDbl(rs2("optPriceDiff"))<>0 then
aOption(1,index) = aOption(1,index) & " ("
if cDbl(rs2("optPriceDiff")) > 0 then aOption(1,index) = aOption(1,index) & "+"
aOption(1,index) = aOption(1,index) & FormatEuroCurrency(rs2("optPriceDiff"))&")"
end if
aOption(1,index) = aOption(1,index) & "</option>"&vbCrLf
rs2.MoveNext
loop
aOption(1,index) = aOption(1,index) & "</select></td></tr>"
end if
end if
aOption(0,index) = Int(prodoptions(0,rowcounter))
rs2.Close
end if
response.write Replace(Replace(aOption(1,index),"optnPLACEHOLDER","optn"&rowcounter),"updatepricePLACEHOLDER","updateprice"&Count,1,1)
next
response.write "</table>"
end if
%></p>
</td>
</tr>
<tr>
<td width="20%" valign="top"><% if useemailfriend then %>
<a href="javascript:openEFWindow('<%=Server.URLEncode(Trim(request.querystring("prod")))%>')"><strong><%=xxEmFrnd%></strong></a>
<% else %>
<% end if %></td>
<td width="60%" align="center" valign="top" colspan="2">
<% if noprice=true then
response.write " "
else
if cDbl(rs("pListPrice"))<>0.0 then response.write Replace(xxListPrice, "%s", FormatEuroCurrency(rs("pListPrice"))) & "<BR>"
if cDbl(rs("pPrice"))=0 AND pricezeromessage<>"" then
response.write pricezeromessage
else
response.write "<b>" & xxPrice & ":</b> <span id=""pricediv" & Count & """ name=""pricediv" & Count & """>" & FormatEuroCurrency(rs("pPrice")) & "</span> "
if showtaxinclusive=true then response.write Replace(ssIncTax,"%s", "<span id=""pricedivti" & Count & """ name=""pricedivti" & Count & """>" & FormatEuroCurrency(rs("pPrice")+(rs("pPrice")*countryTax/100.0)) & "</span> ")
response.write "<br>"
if currencyseparator="" then currencyseparator=" "
if currRate1<>0 AND currSymbol1<>"" then response.write "<span id=""pricediv1c" & Count & """ name=""pricediv1c" & Count & """>" & FormatNumber(rs("pPrice")*currRate1, checkDPs(currSymbol1)) & " <b>" & currSymbol1 & "</b></span>" & currencyseparator
if currRate2<>0 AND currSymbol2<>"" then response.write "<span id=""pricediv2c" & Count & """ name=""pricediv2c" & Count & """>" & FormatNumber(rs("pPrice")*currRate2, checkDPs(currSymbol2)) & " <b>" & currSymbol2 & "</b></span>" & currencyseparator
if currRate3<>0 AND currSymbol3<>"" then response.write "<span id=""pricediv3c" & Count & """ name=""pricediv3c" & Count & """>" & FormatNumber(rs("pPrice")*currRate3, checkDPs(currSymbol3)) & " <b>" & currSymbol3 & "</b></span>"
end if
end if %>
</td>
<td width="20%" align="right" valign="top">
<%
if nobuyorcheckout=true then
response.write " "
else
if useStockManagement then
isInStock = Int(rs("pInStock")) > 0
else
isInStock = Int(rs("pSell")) <> 0
end if
if isInStock then
%>
<input type="hidden" name="id" value="<%=rs("pID")%>">
<input type="hidden" name="mode" value="add">
<% if showquantondetail=true then %><input type="text" name="quant" size="2" value="1"><% end if %><input align="absmiddle" type="image" src="images/buy.gif" border="0"><%
else
response.write "<b>"&xxOutStok&"</b>"
end if
end if %></td>
</tr>
<%
rs.Close
cnn.Close
%>
</table>
<% else ' if usedetailbodyformat=2 %>
<table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td width="30%" align="center" valign="middle"> <%
if NOT (Trim(rs("pLargeImage"))="" OR IsNull(rs("pLargeImage")) OR Trim(rs("pLargeImage"))="prodimages/") then %>
<img src="<%=rs("pLargeImage")%>" border="0" alt="<%=Replace(rs("pName"),"""",""")%>"> <%
elseif NOT (Trim(rs("pImage"))="" OR IsNull(rs("pImage")) OR Trim(rs("pImage"))="prodimages/") then %>
<img src="<%=rs("pImage")%>" border="0" alt="<%=Replace(rs("pName"),"""",""")%>"> <%
else %> <%
end if %>
</td>
<td> </td>
<td width="70%" valign="top">
<p><% if showproductid=true then response.write "<b>" & xxPrId & ":</b> " & rs("pID") & "<br>" %><b><%=rs("pName")&xxDot%></b><% if alldiscounts<>"" then response.write " <font color=""#FF0000""><strong>"&xxDsApp&"</strong><br><font size=""1"">" & alldiscounts & "</font></font>" %><br>
<% shortdesc = Trim(rs("pDescription"))
longdesc = Trim(rs("pLongDescription"))
if longdesc<>"" then
response.write longdesc&"<BR>"
elseif shortdesc<>"" then
response.write shortdesc&"<BR>"
end if
if noprice=true then
response.write " "
else
if cDbl(rs("pListPrice"))<>0.0 then response.write Replace(xxListPrice, "%s", FormatEuroCurrency(rs("pListPrice"))) & "<BR>"
if cDbl(rs("pPrice"))=0 AND pricezeromessage<>"" then
response.write pricezeromessage
else
response.write "<b>" & xxPrice & ":</b> <span id=""pricediv" & Count & """ name=""pricediv" & Count & """>" & FormatEuroCurrency(rs("pPrice")) & "</span> "
if showtaxinclusive=true then response.write Replace(ssIncTax,"%s", "<span id=""pricedivti" & Count & """ name=""pricedivti" & Count & """>" & FormatEuroCurrency(rs("pPrice")+(rs("pPrice")*countryTax/100.0)) & "</span> ")
response.write "<br>"
if currencyseparator="" then currencyseparator=" "
if currRate1<>0 AND currSymbol1<>"" then response.write "<span id=""pricediv1c" & Count & """ name=""pricediv1c" & Count & """>" & FormatNumber(rs("pPrice")*currRate1, checkDPs(currSymbol1)) & " <b>" & currSymbol1 & "</b></span>" & currencyseparator
if currRate2<>0 AND currSymbol2<>"" then response.write "<span id=""pricediv2c" & Count & """ name=""pricediv2c" & Count & """>" & FormatNumber(rs("pPrice")*currRate2, checkDPs(currSymbol2)) & " <b>" & currSymbol2 & "</b></span>" & currencyseparator
if currRate3<>0 AND currSymbol3<>"" then response.write "<span id=""pricediv3c" & Count & """ name=""pricediv3c" & Count & """>" & FormatNumber(rs("pPrice")*currRate3, checkDPs(currSymbol3)) & " <b>" & currSymbol3 & "</b></span>"
end if
response.write "<hr width=""80%"">"
end if %>
</p>
<p align="center">
<%
if IsArray(prodoptions) then
response.write "<table border='0' cellspacing='1' cellpadding='1' width='100%'>"
for rowcounter=0 to UBOUND(prodoptions,2)
index=0
gotSelection=false
do while index < (maxprodopts-1) AND aOption(0,index)<>0
if aOption(0,index)=Int(prodoptions(0,rowcounter)) then
gotSelection=true
exit do
end if
index = index + 1
loop
if NOT gotSelection then
sSQL="SELECT optID,optName,optGrpName,optPriceDiff,optType FROM options INNER JOIN optionGroup ON options.optGroup=optionGroup.optGrpID WHERE optGroup="&prodoptions(0,rowcounter)&" ORDER BY optID"
rs2.Open sSQL,cnn,0,1
if NOT rs2.EOF then
if Abs(Int(rs2("optType")))=3 then
fieldHeight = cInt((cDbl(rs2("optPriceDiff"))-Int(rs2("optPriceDiff")))*100.0)
aOption(1,index) = "<tr><td align='right' width='30%'>"&rs2("optGrpName")&":</td><td> <input type='hidden' name='optnPLACEHOLDER' value='"&rs2("optID")&"'>"
if fieldHeight<>1 then
aOption(1,index) = aOption(1,index) & "<textarea wrap='virtual' name='voptnPLACEHOLDER' cols='"&atb(Int(rs2("optPriceDiff")))&"' rows='"&fieldHeight&"'>"
aOption(1,index) = aOption(1,index) & rs2("optName")&"</textarea>"
else
aOption(1,index) = aOption(1,index) & "<input maxlength='255' type='text' name='voptnPLACEHOLDER' size='"&atb(Int(rs2("optPriceDiff")))&"' value="""&Replace(rs2("optName"),"""",""")&""">"
end if
aOption(1,index) = aOption(1,index) & "</td></tr>"
else
aOption(1,index) = "<tr><td align='right' width='30%'>"&rs2("optGrpName")&":</td><td> <select onChange='updatepricePLACEHOLDER();' name='optnPLACEHOLDER' size='1'>"
if Int(rs2("optType"))>0 then aOption(1,index) = aOption(1,index) & "<option value=''>"&xxPlsSel&"</option>"
do while not rs2.EOF
aOption(1,index) = aOption(1,index) & "<option value='"&rs2("optID")&"'>"&rs2("optName")
if cDbl(rs2("optPriceDiff"))<>0 then
aOption(1,index) = aOption(1,index) & " ("
if cDbl(rs2("optPriceDiff")) > 0 then aOption(1,index) = aOption(1,index) & "+"
aOption(1,index) = aOption(1,index) & FormatEuroCurrency(rs2("optPriceDiff"))&")"
end if
aOption(1,index) = aOption(1,index) & "</option>"&vbCrLf
rs2.MoveNext
loop
aOption(1,index) = aOption(1,index) & "</select></td></tr>"
end if
end if
aOption(0,index) = Int(prodoptions(0,rowcounter))
rs2.Close
end if
response.write Replace(Replace(aOption(1,index),"optnPLACEHOLDER","optn"&rowcounter),"updatepricePLACEHOLDER","updateprice"&Count,1,1)
next
if nobuyorcheckout<>true then
%>
<tr><td align="right"><%=xxQuant%>:</td><td><input type="text" name="quant" size="<%=atb(4)%>" value="1"></td></tr>
<%
end if
response.write "</table>"
else
if nobuyorcheckout<>true then
%>
<table border='0' cellspacing='1' cellpadding='1' width='100%'>
<tr><td align="right"><%=xxQuant%>:</td><td><input type="text" name="quant" size="<%=atb(4)%>" value="1"></td></tr>
</table>
<%
end if
end if
%></p>
<p align="center">
<%
if nobuyorcheckout=true then
response.write " "
else
if useStockManagement then
isInStock = Int(rs("pInStock")) > 0
else
isInStock = Int(rs("pSell")) <> 0
end if
if isInStock then
%>
<input type="hidden" name="id" value="<%=rs("pID")%>">
<input type="hidden" name="mode" value="add">
<input type="image" src="images/buy.gif" border="0"><%
else
response.write "<b>"&xxOutStok&"</b>"
end if
end if %><br>
<% if previousid<>"" OR nextid<>"" then %>
<% if previousid<>"" then %><a href="proddetail.asp?prod=<%=previousid%>"><% end if %><b>« Previous</b><% if previousid<>"" then %></a><% end if %> |
<% if nextid<>"" then %><a href="proddetail.asp?prod=<%=nextid%>"><% end if %><b>Next »</b><% if nextid<>"" then %></a><% end if %>
<br>
<% end if %>
<hr width="80%"></p>
<% if useemailfriend then %>
<p align="center"><a href="javascript:openEFWindow('<%=Server.URLEncode(Trim(request.querystring("prod")))%>')"><strong><%=xxEmFrnd%></strong></a></p>
<% end if %>
</td>
</tr>
<%
rs.Close
cnn.Close
%>
</table>
<% end if ' usedetailbodyformat %>
</form>
</td>
</tr>
</table>