% @Language=VBScript %>
<%
'Functions/Subs declaration
Sub WriteProdOption (nId,n)
'----------------------------------------------------------
' Writes the select box with the contents of the option nId
' Sets bFoundOpt to True if it prints any option (use for
' formatting).
'----------------------------------------------------------
Dim str
Dim options
str = rs ("OptionsV" & nId)
If str <> "" Then
options = split(str,",")
Response.Write rs ("OptionsD" & nId) & ": "
bFoundOpt = True
End If
End Sub
Sub WriteRelProds (PID)
'----------------------------------------------------------
' Writes a list of all the products related to the one
' shown (Cross-sell)
'----------------------------------------------------------
Dim strSQL, RPRs, aryRP, nNumRows, i
Dim fldProdId, fldName
strSQL = "SELECT Products.ProdId, Products.Name FROM Products, RelatedProds " & _
"WHERE Products.ProdId = RelatedProds.RelProdId " & _
"AND RelatedProds.ProdID = '" & PID & "' AND RelatedProds.Type = 1 AND Products.Show = 1"
set RPRs = conn.Execute (strSQL)
If NOT (RPRs.EOF AND RPRs.BOF) Then
aryRP = RPRs.GetRows
nNumRows = UBound(aryRP,2)
RPRs.Close
set RPRs = nothing
fldProdId = 0
fldName = 1
%>
We also suggest the following products:
")
End Sub
Sub DisplayProductDetails (nProd)
'----------------------------------------------------------
' Writes product details and form
' Requires recordset rs with the details of the product
' Input:
' - nProd (integer): Specifies 1 or 2 depending on whether is
' the first or the second product displayed.
'----------------------------------------------------------
Dim Stock, bFoundOpt
Dim nActualCost
Dim nListCost 'List price (before discount)
Dim bIsOffer 'Product on special offer (used for formatting)
Dim nVATRate 'VAT Rate
Dim nTaxable 'Taxable product?
'Load the prices into variables
If rs("Offer") <> "" Then
'Product on sale
nActualCost = rs("Offer") 'Actual price is the offer price
nListCost = rs("Price") 'List price (before discount)
bIsOffer = True 'Product on special offer (used for formatting)
Else
'Normal price
nActualCost = rs("Price") 'Actualprice is the list price
nListCost = nActualCost 'Actual and list price are the same
bIsOffer = False 'Product is not on special offer (used for formatting)
End If
nVATRate = rs("VATRate")
nTaxable = rs("Taxable")
%>
<% '======================
'Display product Images
' Define here the type of display you want to use (nDispType):
' displayProdImage (sPicPath, sPicPath2, nDispType)
'======================
Call displayProdImage (Trim(rs("PicPath")), Trim(rs("PicPath2")),rs("ImgDisplayType"))
'Print relative price if available
If rs("PriceRel") <> "" Then
Response.Write " Relative: " & rs("PriceRel")
End If
'Display Product ID
Response.Write " SKU: " & ProdID
%>
<%
If Application("SecCurName") <> "" Then %>
<%= FormatSecCurr (FormatPrice(nActualCost,nVATRate,nTaxable)) %>
<% End If %>
<%
Stock = CInt(rs("Stock"))
If Stock > 0 AND shop_StockControl Then
Response.Write Stock & " in stock "
End If%>
&Cat=<%= rs("CatID") %>&path=<%= Request("path") %>">Add to My List
<%= rs("Name") %>
">
">
<%= rs("Description") %>
<% If bIsOffer Then %>
Offer: <%= FormatDefCurr(FormatPrice(nActualCost,nVATRate,nTaxable))%> / <%= Replace(UnitPrs (int(rs("Units"))),"/s","") %>
(Before: <%= FormatDefCurr(FormatPrice(nListCost,nVATRate,nTaxable))%>)
You save: <%= FormatNumber((1-(CDbl(nActualCost)/CDbl(nListCost)))*100,0) %>%
<% Else %>
<%= FormatDefCurr(FormatPrice(nActualCost,nVATRate,nTaxable))%>/<%= Replace(UnitPrs (int(rs("Units"))),"/s","") %>
<% End If
'If we should show VAT then add the "VAT included" message.
If Tax_ShowVAT = 1 AND Tax_Model = "EU" Then
Response.Write "
(" & nVATRate & "% VAT Included)
"
End If %>
Section: <% Response.Write "" & rs("CatName") & "" %>
<% If rs("Manufacturer") <> "" Then %>
Manufacturer: <% Response.Write "" & rs("Manufacturer") & " " %>
<% End If %>
<% If rs("AvailDescription") <> "" Then Response.Write "Availability: " & rs("AvailDescription") & " " %>
<%
'Writes Options 1 and 2 select boxes if any.
Call WriteProdOption(1, nProd)
Call WriteProdOption(2, nProd)
'If there are price options then add an extra space
If bFoundOpt Then
Response.Write("
")
bFoundOpt = False
End If
'Get string with the HTML for an option.
strPO = WritePriceOptions (rs("ProdID"), nProd)
'If there were options then display them
If strPO <> "" Then Response.Write " " & strPO & " "
'Reset the Price Options HTML code
strPO = ""
%>
<%
If Stock > 0 OR NOT shop_StockControl Then %>
Quantity : "> <%= UnitPrs (int(rs("Units"))) %>
">
">
Add also to My List
<% Else
Response.Write "
Product temporarily out of stock
"
End If %>
<%
End Sub
'----------------------------------------------------------
' Display product image/s
' Input:
' - sPicPath (string): Specifies 1 or 2 depending on whether is
' the first or the second product displayed.
'----------------------------------------------------------
Sub displayProdImage (sImgPath, sImgPath2, nDispType)
Dim sSide 'Side of the image (sImgPath or sImgPath2) Values: F|B
Dim aryImgPath 'Array with all the main pictures
Dim i
sSide = Request.QueryString("Side")
'Set default value
If nDispType = "" Or IsNull(nDispType) Then nDispType = 0
aryImgPath = Split(sImgPath,",")
'If there is no image display the standard "no image available" image
If UBound(aryImgPath) < 0 Then
Response.Write " " & LineLogoURL & "
"
Exit Sub
End If
'Standard display (1 picture + link to back view)
If nDispType = 0 Then
If sImgPath <> "" Then
'Backside image
If sSide <> "B" Then
Response.Write ""
'Fron image (default)
Else
'If the second image exists display it, otherwise display the fron one as
'default (just in case).
If sImgPath2 <> "" Then
Response.Write ""
Else
Response.Write ""
End If
End If
Else
Response.Write " " & LineLogoURL & "
"
End If
'Place link if there is an image of the other side
If sImgPath2 <> "" Then
Response.Write " [ View Back Of Image ]"
End If
'List display (images in picpath displayed one after the other)
'sImgPath (PicPath2) is ignored.
ElseIf nDispType = 10 Then
For i = LBound(aryImgPath) to UBound(aryImgPath)
Response.Write " "
Next
'Display link to zoom image
If sImgPath2 <> "" Then
Response.Write " Zoom Image "
End If
'Scrollable images (only one at a time using JavaScript)
ElseIf nDispType = 20 Then %>
<%
Response.Write " "
Response.Write " More Views: "
For i = LBound(aryImgPath) + 1 to UBound(aryImgPath) + 1
If i < UBound(aryImgPath) + 1 Then
Response.Write "" & i & " "
Else
Response.Write "" & i & " "
End If
Next
'Display link to zoom image
If sImgPath2 <> "" Then
Response.Write " Zoom Image "
End If
End If
End Sub
%>
<%= shop_Title %>
<%= LogoURL %>
<% Dim ProdID
ProdID = Request.QueryString("ProdID")
Set rs = Server.CreateObject("ADODB.Recordset")
sql= "SELECT Products.*, Manufacturer.*, Products.ManuID as ManufID, Categories.Titulo As CatName, Availability.AvailDescription FROM ((Products LEFT OUTER JOIN Manufacturer ON Products.ManuId = Manufacturer.ManuId) INNER JOIN Categories ON Categories.CatID = Products.CatID) LEFT OUTER JOIN Availability ON Products.AvailabilityID = Availability.AvailabilityID WHERE Products.show = 1 AND ProdID = '" & ProdID & "'"
rs.Open sql,Conn, adOpenStatic, adLockReadOnly
%>
If you would like to order this product, specify the quantity, and desired options (if applicable). Then, click on the Add to Cart icon. You can also continue shopping clicking on the Back link or by using your browser's "Back" button.
<%
'Display related products for the current product
WriteRelProds (ProdID) %>