%@ Language=VBScript %>
<%
'*************************************************************************
' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK!
' Function : "Home" Page for Store Front
' Product : CandyPress Store Frontend
' Version : 2.5
' Modified : February 2004
' Copyright: Copyright (C) 2004 CandyPress.Com
' See "license.txt" for this product for details regarding
' licensing, usage, disclaimers, distribution and general
' copyright requirements. If you don't have a copy of this
' file, you may request one at webmaster@candypress.com
'*************************************************************************
Option explicit
Response.Buffer = true
%>
<%
'Database
dim mySQL
dim conntemp
dim rstemp
dim rstemp2
'Session
dim idOrder
dim idCust
'*************************************************************************
'Open Database Connection
call openDB()
'Store Configuration
if loadConfig() = false then
call errorDB(langErrConfig,"")
end if
'Get/Set Cart/Order Session
idOrder = sessionCart()
'Get/Set Customer Session
idCust = sessionCust()
'Get/Set Affilate ID
call getIdAffiliate(Request.QueryString("idAff"))
%>
<%
'Close Database Connection
call closeDB()
'**********************************************************************
'Main Shopping Cart Display Area.
'**********************************************************************
sub cartMain()
%>
<%
'Get Featured Products
mySQL="SELECT idProduct,description,descriptionLong," _
& " listPrice,price,smallImageUrl,stock," _
& " fileName,noShipCharge,sortOrder " _
& "FROM products " _
& "WHERE active = -1 " _
& "AND homePage = -1 " _
& "ORDER BY sortOrder ASC,idProduct DESC "
set rsTemp = openRSopen(mySQL,adUseClient,adOpenStatic,adLockOptimistic,adCmdText,0)
'Randomize the recordset
if homeViewRandom > 0 and rsTemp.RecordCount > 2 then
'Disconnect recordset and initialize random seed
set rsTemp.ActiveConnection = nothing
randomize()
'Update sortOrder field with random numbers and sort
do while not rsTemp.EOF
rsTemp.Update "sortOrder",Int((9999 * Rnd) + 1)
rsTemp.MoveNext
loop
rsTemp.Sort = "sortOrder"
'Delete any extra records from disconnected recordset
rsTemp.move homeViewRandom,1
do while not rsTemp.EOF
rsTemp.Delete
rsTemp.MoveNext
loop
'Reposition to first record
rsTemp.MoveFirst
end if
'If Featured Products = 0 then use "_INCright_.asp"
if rsTemp.EOF then
call noProd()
else
'If Featured Products <= 2 then display single rows: Disabled NP
'if rsTemp.RecordCount <= 2 then
'do while not rsTemp.EOF
'call singleProd()
'if not rsTemp.EOF then
'rsTemp.MoveNext
'end if
'loop
'If Featured Products > 2 then display double rows
'else
'do while not rsTemp.EOF
'call doubleProd()
'if not rsTemp.EOF then
'rsTemp.MoveNext
'end if
'loop
'end if
'Restricted to single row (Nick Procter)
response.Write("
")
do while not rsTemp.EOF
call singleProd()
if not rsTemp.EOF then
rsTemp.MoveNext
end if
loop
response.Write("
")
end if
%>
<%
end sub
'**********************************************************************
'Displayed when there are no Featured Products.
'**********************************************************************
sub noProd()
%>