<% option explicit Response.Buffer = True '@BEGINVERSIONINFO '@APPVERSION: 5.10.00 '@FILENAME: NewProduct.asp '@FILEVERSION: 1.0.0 '@VERSIONDATETIME: 1/26/01 '@DESCRIPTION: Retrieves New Products for Display '@STARTCOPYRIGHT 'The contents of this file is protected under the United States 'copyright laws as an unpublished work, and is confidential and proprietary to 'LaGarde, Incorporated. Its use or disclosure in whole or in part without the 'expressed written permission of LaGarde, Incorporated is expressly prohibited. ' '(c) Copyright 2000 by LaGarde, Incorporated. All rights reserved. '@ENDCOPYRIGHT '@ENDVERSIONINFO ' Constant Declarations const varDebug = 0 'DeBug Setting const iPageSize = 10 'Number of Records per Page const iMaxRecords = 0 'Maximum amount of records returned, 0 is no maximum const iDaysBack = 14 'Number of days back to look for Added products Dim txtsearchParamTxt, txtsearchParamType, txtsearchParamCat, txtFromSearch, txtsearchParamMan, srchDate Dim txtCatName, txtsearchParamVen, txtImagePath, txtOutput, txtDateAddedStart Dim txtDateAddedEnd, txtPriceStart, txtPriceEnd, txtSale, SQL, sAmount Dim iAttCounter, irsSearchAttRecordCount, iAttDetailCounter, irsSearchAttDetailRecordCount Dim iPage, iRec, iNumOfPages, iDesignCounter, iVarPageSize, iSearchRecordCount, icounter Dim rsCat, iDesign,rsSearch, rsSearchAtt, rsSearchAttDetail, rsCatImage, arrAttDetail, arrProduct, arrAtt, CurrencyISO %> <% CurrencyISO = getCurrencyISO(Session.LCID) If iConverion = 1 Then Response.Write "" iDesign = C_DesignType 'Page Layout iDesignCounter = 2 iVarPageSize = iPageSize ' Records Per Page txtsearchParamCat = "ALL" srchDate = MakeUSDate(Date()-iDaysBack) Set rsSearch = Server.CreateObject("ADODB.RecordSet") ' ------------------------------------------- ' RecordSet Paging Setup -------------------- ' ------------------------------------------- SQL = "SELECT ProdID, prodName, prodImageSmallPath, prodLink, prodPrice, prodSaleIsActive, prodSalePrice, catName, prodDescription, prodAttrNum, prodCategoryId, prodShortDescription " _ & "FROM sfProducts INNER JOIN sfCategories ON sfProducts.prodCategoryId = sfCategories.catID WHERE (prodDateAdded >= #" & srchDate & "# AND prodEnabledIsActive = 1)" If varDebug = 1 Then Response.Write SQL & "

" With rsSearch .CursorLocation = adUseClient .CacheSize = iVarPageSize .MaxRecords = iMaxRecords .Open SQL, cnn, adOpenForwardOnly, adLockReadOnly, adCmdText .PageSize = iVarPageSize End With ' Determine the page user is requesting If Request.QueryString("PAGE") = "" Then iPage = 1 Else iPage = CInt(Request.QueryString("PAGE")) ' Protect against out of range pages, in case ' of a user specified page number If iPage < 1 Then iPage = 1 Else If iPage > rsSearch.PageCount Then iPage = rsSearch.PageCount Else iPage = CInt(Request.QueryString("PAGE")) End If End If End If iSearchRecordCount = rsSearch.RecordCount iNumOfPages = Int(iSearchRecordCount / iPageSize) If CInt(iNumOfPages+1) = CInt(iPage) Then iVarPageSize = rsSearch.RecordCount - (iNumOfPages * iPageSize) If NOT rsSearch.EOF Then rsSearch.AbsolutePage = CInt(iPage) ' Create Attribute Record Sets for product on page SQL = getAttributeSQL(rsSearch, iVarPageSize, iPage) If varDebug = 1 Then Response.Write SQL & "

" Set rsSearchAtt = Server.CreateObject("ADODB.RecordSet") If SQL <> "" Then rsSearchAtt.Open SQL, cnn, adOpenKeyset, adLockReadOnly, adCmdText SQL = getAttributeDetailSQL(rsSearchAtt) If varDebug = 1 Then Response.Write SQL & "

" If SQL <> "" Then Set rsSearchAttDetail = Server.CreateObject("ADODB.RecordSet") rsSearchAttDetail.Open SQL, cnn, adOpenKeyset, adLockReadOnly, adCmdText End If End If If txtsearchParamCat = "ALL" Then txtCatName = "All " & C_CategoryNameP Else If Not rsSearch.EOF Then txtCatName = rsSearch.Fields("catName") Else Set rsCat = Server.CreateObject("ADODB.RecordSet") SQL = getCategorySQL(txtsearchParamCat) rsCat.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly, adCmdText txtCatName = rsCat.Fields("catName") closeObj(rsCat) End If End If If txtsearchParamTxt = "" Then txtsearchParamTxt = "*" 'Corrects Number of Pages if there is overflow less then records per page If iSearchRecordCount mod iPageSize <> 0 Then iNumOfPages = iNumOfPages + 1 %> SF New Products Page
<%If C_BNRBKGRND = "" Then%> <%Else%> <%End If%>
<%= C_STORENAME %>
 
New Products
Check Out
Search for: <%= txtsearchParamTxt %> in <%= C_CategoryNameS %>: <%= txtCatName %><% %>
<%= iSearchRecordCount %> Records Returned <%= iVarPageSize %> Records Displayed.
New Search|Advanced Search

<% If iNumOfPages <> 1 And iNumOfPages <> 0 Then Response.Write bottomPaging(iPage, iPageSize, iSearchRecordCount, iNumOfPages, "NewProducts") %>


<% ' ------------------------------------------- ' Empty Search Results ---------------------- ' ------------------------------------------- If rsSearch.EOF Then txtOutput = "" _ & "" _ & "" _ & "" _ & "" _ & "" _ & "
Sorry, No Items are Newly Added!

" _ & "
" Response.Write txtOutput 'Response.End Else ' ------------------------------------------- ' SEARCH RESULT PRODUCT OUTPUT ::: BEGIN ---- ' ------------------------------------------- 'create arrays for display arrProduct = rsSearch.GetRows(iVarPageSize) If Not rsSearchAtt.EOF Then arrAtt = rsSearchAtt.GetRows irsSearchAttRecordCount = rsSearchAtt.RecordCount-1 If Not rsSearchAttDetail.EOF Then arrAttDetail = rsSearchAttDetail.GetRows irsSearchAttDetailRecordCount = rsSearchAttDetail.RecordCount-1 End If End If For iRec = 0 to iVarPageSize-1 ' Set Default Image if none specified for product If arrProduct(2, iRec) = "" Then Set rsCatImage = Server.CreateObject("ADODB.RecordSet") SQL = "SELECT catImage FROM sfCategories WHERE catID = " & arrProduct(10, iRec) rsCatImage.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly, adCmdText txtImagePath = rsCatImage.Fields("catImage") closeObj(rsCatImage) Else txtImagePath = arrProduct(2, iRec) End If icounter = 1 %>
<% If iDesign = "1" Then %> <% ElseIf iDesign = "3" And (iDesignCounter / 2) = Int(iDesignCounter / 2) Then%> <% End If %> <% If iDesign = "2" Then %> <% ElseIf iDesign = "3" And (iDesignCounter / 2) <> Int(iDesignCounter / 2) Then %> <% End If %> <% Response.Write "
<%If txtImagePath <> "" Then%><%ElseIf Trim(arrProduct(3, iRec)) <> "" Then %>Link<%End If%>
<%If txtImagePath <> "" Then%><%ElseIf Trim(arrProduct(3, iRec)) <> "" Then %>Link<%End If%>
<%= C_ProductID %>: <%= arrProduct(0, iRec) %>    <%= C_CategoryNameS %>: <%= arrProduct(7, iRec) %>
<%= arrProduct(1, iRec) %>
<%= C_Description %>: <%If arrProduct(11, iRec) <> "" Then%><%= arrProduct(11, iRec) %><%Else%><%= arrProduct(8, iRec) %><%End If%>
<%= C_Price %>:  <% If iConverion = 1 Then If arrProduct(5, iRec) = 1 Then Response.Write "
" Response.Write "" & C_SPrice & ":
" Response.Write "" & C_YSave & ":
" Else Response.Write "" End If Else If arrProduct(5, iRec) = 1 Then Response.Write "" & FormatCurrency(arrProduct(4, iRec)) & "
" Response.Write "" & C_SPrice & ": " & FormatCurrency(arrProduct(6, iRec)) & "
" Response.Write "" & C_YSave & ": " & FormatCurrency(CDbl(arrProduct(4, iRec))-CDbl(arrProduct(6, iRec))) & "
" Else Response.Write FormatCurrency(arrProduct(4, iRec)) End If End If %>

<% ' ------------------------------------------- ' SEARCH RESULT ATTRIBUTE OUTPUT ::: BEGIN -- ' ------------------------------------------- If irsSearchAttRecordCount <> "" Then For iAttCounter = 0 to irsSearchAttRecordCount If arrProduct(0, iRec) = arrAtt(2, iAttCounter) Then %> <% icounter = icounter + 1 End If Next End If ' ------------------------------------------- ' SEARCH RESULT ATTRIBUTE OUTPUT ::: END ' ------------------------------------------- %>
<%= arrAtt(1, iAttCounter) %>

<%= C_Quantity %>:

<% If iSaveCartActive = 1 Then%> <% End if If iEmailActive = 1 Then %> Email a Friend <% End If %>

<%If txtImagePath <> "" Then%><%Else%>Link<%End If%>
<%If txtImagePath <> "" Then%><%Else%>Link<%End If%>

" Response.Flush If iDesign = "3" Then iDesignCounter = iDesignCounter + 1 Next ' ------------------------------------------- ' SEARCH RESULT PRODUCT OUTPUT ::: END ------ ' ------------------------------------------- End If %>

<% ' ------------------------------------------- ' SEARCH RESULT PAGING OUTPUT ::: BEGIN ----- ' ------------------------------------------- If iNumOfPages <> 1 And iNumOfPages <> 0 Then Response.Write bottomPaging(iPage, iPageSize, iSearchRecordCount, iNumOfPages, "NewProducts") ' ------------------------------------------- ' SEARCH RESULT PAGING OUTPUT ::: END ------- ' ------------------------------------------- %>

<% ' Object Cleanup closeObj(rsSearch) closeObj(rsSearchAtt) closeObj(rsSearchAttDetail) closeObj(cnn) %>