<% '************************************************************************************ '* * '* MODIFICATION TO THIS SCRIPT OR ANY FILES INCLUDED WITH * '* ONEWORLDSTOREFRONT IS DONE AT YOUR OWN RISK! * '* Product : OneWorldStoreFront * '* Copyright: Copyright (C) 2004 OneWorldStoreFront.Com * '* Registration Number: 1024507 * '* http://strategis.ic.gc.ca/ * '* * '************************************************************************************ Dim idCategory, sIDProduct, sDescription, sPrice, sSmallImageURL, sStock, sBToBPrice, sVisits '************************************************************************************ '* * '* * '* * '************************************************************************************ Sub ActionSubroutine() If ( iOWRowsShown = "" ) Or ( NOT IsNumeric(iOWRowsShown) ) Then iOWRowsShown = 5 End If ' display the collage html Response.Write LANG_DT( "HOMEPAGE_COLLAGE", "" ) ' define the array to store products (2 columns) Randomize() iRandomNumber = Int (1000*Rnd)+1 sSQLText = "SELECT TOP " & iOWRowsShown & " idProduct, description, details, price, smallImageURL, stock, bToBPrice, visits, Rnd(" & -1*iRandomNumber & "*idProduct) AS RandCol FROM Products WHERE showInHome=-1 AND active=-1 AND Stock > 0 ORDER BY 9" Call DB_getFromDatabase(sSQLText, rsStoreData, "") If ( NOT rsStoreData.EOF ) Then Response.Write "" While ( NOT rsStoreData.EOF ) Response.Write "" Wend Response.Write "
" For iX = 0 to (iNumColums-1) Response.Write "" rsStoreData.MoveNext If ( rsStoreData.EOF ) Then For iX1 = iX to (iNumColums-1) Response.Write "" Next Exit For End If Next Response.Write "
" sIDProduct = rsStoreData("idProduct") sDescription = rsStoreData("description") sPrice = rsStoreData("price") sStock = rsStoreData("stock") sBToBPrice = rsStoreData("bToBprice") sVisits = rsStoreData("visits") sSmallImageURL = rsStoreData("smallImageURL") call singleProd(rsStoreData) Response.Write "
" End If Call DB_closeRecordset(rsStoreData) %> <% Response.Write "
" Call DispProductColumn("") Response.Write "" Call DispProductColumn("Clearance") Response.Write "
" End Sub '************************************************************************************ '************************************************************************************ '* * '* * '* * '************************************************************************************ Sub DispProductColumn(sType) Dim rsStoreData Set rsStoreData = CreateObject("ADODB.Recordset") Randomize() iRandomNumber = Int (1000*Rnd)+1 If ( sType = "Clearance" ) Then sSQLText = "SELECT TOP 5 P.idProduct, P.smallImageURL, P.description, P.price, P.bToBprice, P.stock, Rnd(" & -1*iRandomNumber & "*idProduct) AS RandCol, idSupplier FROM Products P WHERE P.Clearance = -1 AND P.listhidden=0 AND P.active=-1 ORDER BY 7" Else sSQLText = "SELECT TOP 5 P.idProduct, P.smallImageURL, P.description, P.price, P.bToBprice, P.stock, Rnd(" & -1*iRandomNumber & "*idProduct) AS RandCol, idSupplier FROM Products P WHERE P.hotDeal = -1 AND P.listhidden=0 AND P.active=-1 ORDER BY 7" End If Call DB_getFromDatabase(sSQLText, rsStoreData, "") If ( NOT rsStoreData.EOF ) Then If ( sType = "Clearance" ) Then Response.Write "
" Else Response.Write "
" End If %> <% While ( NOT rsStoreData.EOF ) sSmallImageURL = rsStoreData("smallImageURL") sDescription = rsStoreData("description") sPrice = rsStoreData("price") sBToBPrice = rsStoreData("bToBprice") sStock = rsStoreData("stock") sIDProduct = rsStoreData("IDProduct") %> <% rsStoreData.MoveNext Wend %>
<% If ( Trim(sSmallImageURL) <> "" ) Then %>
<%If ( bOWAdvancedImages ) Then%> <%Else%> <%End If%>
<% Else %> &idCategory=<%=idCategory%>"> <%=Server.HTMLEncode(LANG_DT( " border=0>
<% End If %>
<% sBrand = ACCNT_ReturnADV("OW_CUSTCOMPANY", "V", rsStoreData("idSupplier"), C_OVERRIDE_ADV) If ( sBrand <> "" ) Then sBrand = sBrand & "
" End If %> <%=sBrand%> <%=sDescription%>
<% If ( ACCNT_InGroup(iLoginAccountUnq, C_GROUP_DEALER) ) Then sOW_DEALERLEVEL = ACCNT_ReturnADV("OW_DEALERLEVEL", "V", iLoginAccountUnq, C_OVERRIDE_ADV) If ( sOW_DEALERLEVEL <> "" ) Then sSQLText = "SELECT Price FROM DealerProdRef (NOLOCK) WHERE DealerLevelsUnq = " & sOW_DEALERLEVEL & " AND idProduct = " & sIDProduct Call DB_getFromDatabase(sSQLText, rsStoreData2, "") If ( NOT rsStoreData2.EOF ) Then %> <%=LANG_DT( "DEFAULT_DEALERPRICE", "Dealer Price" )%>: <%=CONVERSION_Currency(rsStoreData2("Price"))%> <% Else ' this product doesn't have a dealer price at this level, so fall back to retail price %> <%=LANG_DT( "DEFAULT_OURPRICE", "Our Price" )%>: <%=CONVERSION_Currency(sPrice)%> <% End If Call DB_closeRecordset(rsStoreData2) Else ' this dealer hasn't been assigned a dealer level, so fall back to retail price %> <%=LANG_DT( "DEFAULT_OURPRICE", "Our Price" )%>: <%=CONVERSION_Currency(sPrice)%> <% End If Else if sBtoBPrice>0 and (bOWShowBtoBPrice or ACCNT_InGroup(iLoginAccountUnq, C_GROUP_WHOLESALE)) then Response.Write LANG_DT( "DEFAULT_OURPRICE", "Our Price" ) & ": " & CONVERSION_Currency(sBToBPrice) Else Response.Write LANG_DT( "DEFAULT_OURPRICE", "Our Price" ) & ": " & CONVERSION_Currency(sPrice) End If End If %>
<%If ( sStock > 0 ) Then%> <%=LANG_DT( "DEFAULT_ADDTOCART", "Add To Cart!" )%> <%End If%>
<% End If Call DB_closeRecordset(rsStoreData) Set rsStoreData = Nothing End Sub '************************************************************************************ '************************************************************************************ '* * '* * '* * '************************************************************************************ sub singleProd(rsStoreData) ' get the category this product is in so we can display links to "Buy now" and to view it's details sSQLText = "SELECT c.idCategory FROM categories c, CatProdMap cp, products p WHERE p.idProduct=cp.idProduct AND cp.idCategory=c.idCategory AND p.idProduct = " & sIDProduct Call DB_getFromDatabase(sSQLText, rsStoreData2,"") If ( NOT rsStoreData2.EOF ) Then idCategory = rsStoreData2("idCategory") Else idCategory = 1 End If Call DB_closeRecordset(rsStoreData2) %>
<%call prodImage(rsStoreData)%> <%call prodDetail(rsStoreData)%>
 


<% end sub '************************************************************************************ '************************************************************************************ '* * '* * '* * '************************************************************************************ sub prodImage(rsStoreData) Response.Write "
" If ( Trim(sSmallImageURL) <> "" ) Then %> &idCategory=<%=idCategory%>"><%=server.HTMLEncode(rsStoreData(" border=0 width=150>
<% Else %> &idCategory=<%=idCategory%>"> <%=Server.HTMLEncode(LANG_DT( " border=0>
<% End If Response.Write "
" end sub '************************************************************************************ '************************************************************************************ '* * '* * '* * '************************************************************************************ Sub prodDetail(rsStoreData) Dim rsStoreData2 Set rsStoreData2 = CreateObject("ADODB.Recordset") Response.Write "" if sBtoBPrice>0 and (bOWShowBtoBPrice or ACCNT_InGroup(iLoginAccountUnq, C_GROUP_WHOLESALE)) then Response.Write CONVERSION_Currency(sBToBPrice) Else Response.Write CONVERSION_Currency(sPrice) End If %>
<%=sDescription%>
<%if bOWShowStockView then%> (<%=LANG_DT( "DEFAULT_CURSTOCK", "Current Stock" )%>: <%=sStock%>) <%End If%>
<%=LANG_DT( "DEFAULT_POPU", "Popularity" )%>: <%=sVisits%> <% Call DB_getFromDatabase("SELECT NumRanking, Ranking FROM Products WHERE idProduct = " & sIDProduct, rsStoreData2, "") If ( NOT rsStoreData2.EOF ) Then dNumRanking = rsStoreData2("NumRanking") dRanking = rsStoreData2("Ranking") If ( dNumRanking > 0 ) Then Response.Write "
" End If End If Call DB_closeRecordset(rsStoreData2) %>
<%If ( sStock > 0 ) And ( NOT bOWStoreClosed ) Then%> <%End If%>
<% Set rsStoreData2 = Nothing End Sub '************************************************************************************ %>