<% '************************************************************************* ' ASP Scripting: ' Filename: view_product_line_categories.asp ' Written by: Wilbert Madarang ' Date: January 25, 2002 '************************************************************************* ' Description: This is one method of presenting the Generic Category ' Page. '************************************************************************* ' Revision History: '************************************************************************* %> <% Dim strProductLineId, strPageNo, nPageNo 'Retrieve Web Parameters strProductLineId = Request("product_line_id") strPageNo = Request("page") nPageNo = CInt( strPageNo ) %> Welcome to Charister.com
<% If strPageNo <> 0 Then Response.Write "" End If %>
<% If strPageNo <> 0 Then Call printPageNavBar_PerPage() Else Response.Write "

" End If %>
<% Call printProductLineTitle( strProductLineId ) %>
<% Call printProductLineCategories( strPageNo ) %>
" Call printPageNavBar_AllPages() Response.Write "
<% '************************************************************************* ' Function: printPageNavBar_PerPage ' Description: prints the Page Navigational Bar per Page ' Parameters: none ' Returns: none ' Written by: Wilbert Madarang ' Date: January 30, 2003 '************************************************************************* Function printPageNavBar_PerPage() Dim strUrl, strCurrentPage, strLastPage, strPrevPage, strNextPage, strNumberOfDisplayItemsPerPage, nRecordCount strUrl = getUrl() strCurrentPage = strPageNo strNumberOfDisplayItemsPerPage = getNumberOfDisplayItemsPerPage( strProductLineId ) nRecordCount = getRecordCountByCategories( strProductLineId ) strLastPage = getLastPage( nRecordCount, strNumberOfDisplayItemsPerPage ) strPrevPage = getPrevPage( strCurrentPage ) strNextPage = getNextPage( strCurrentPage, strLastPage ) Response.Write "" Response.Write "" Response.Write "" Response.Write " Page " & strCurrentPage & " of " & strLastPage & " " Response.Write "" Response.Write "" Response.Write " " End Function '************************************************************************* ' Function: printPageNavBar_AllPages ' Description: prints the Page Navigational Bar for All Pages ' Parameters: none ' Returns: none ' Written by: Wilbert Madarang ' Date: January 30, 2003 '************************************************************************* Function printPageNavBar_AllPages() Dim strUrl, strCurrentPage, strNumberOfDisplayItemsPerPage, strLastPage, nRecordCount strUrl = getUrl() strCurrentPage = strPageNo strNumberOfDisplayItemsPerPage = getNumberOfDisplayItemsPerPage( strProductLineId ) nRecordCount = getRecordCountByCategories( strProductLineId ) strLastPage = getLastPage( nRecordCount, strNumberOfDisplayItemsPerPage ) Response.Write "" & vbCrLf Response.Write "" & vbCrLf For pageNo = 1 to CInt(strLastPage) Response.Write "" & vbCrLf Next Response.Write "
" & vbCrLf Response.Write "" & "" & " " &"" Response.Write "" & vbCrLf Response.Write "" & " " & pageNo & " " &"" Response.Write "
" & vbCrLf ' ay051405 Remove to add View All selection, need table printing for alignment reason ' Response.Write "" & vbCrLf ' For pageNo = 1 to CInt(strLastPage) ' Response.Write "" & " " & pageNo & " " &"" ' Next End Function '************************************************************************* ' Function: printProductLineTitle ' Description: prints the product line Title ' Parameters: none ' Returns: none ' Written by: Wilbert Madarang ' Date: January 25, 2003 '************************************************************************* Function printProductLineTitle( strProductLineId ) Dim strTitleImgLocation SELECT CASE strProductLineId CASE BED_LINEN_COLLECTION strTitleImgLocation = BED_LINEN_COLLECTION_GIF CASE DECORATIVE_PILLOWS strTitleImgLocation = DECORATIVE_PILLOWS_GIF CASE WINDOW_TREATMENT strTitleImgLocation = WINDOW_TREATMENT_GIF CASE ACCESSORIES strTitleImgLocation = ACCESSORIES_GIF CASE FURNISHINGS strTitleImgLocation = FURNISHINGS_GIF CASE ELSE END SELECT Response.Write "" End Function '************************************************************************* ' Function: printProductLineCategories ' Description: print Patterns ' Parameters: strPage Number ' Returns: none ' Written by: Wilbert Madarang ' Date: January 27, 2003 '************************************************************************* Function printProductLineCategories( strPageNo ) Dim rs, strImage Dim nDisplayItemsPerPage, nDisplayColumnsPerPage, nRecordNumber 'Obtain Records from Database strSQL = getSQLCallPerProductLine( strProductLineId ) Call openDataConnection() Set rs = dataConnection.Execute( strSQL ) Call closeDataConnection() 'Adjust Cursor If strPageNo > 0 Then nDisplayItemsPerPage = getNumberOfDisplayItemsPerPage( strProductLineId ) Else nDisplayItemsPerPage = 100 End If nDisplayColumnsPerpage = getNumberOfDisplayColumnsPerPage( strProductLineId ) If strPageNo > 0 Then nRecordNumber = (CInt(strPageNo)-1) * nDisplayItemsPerPage Else nRecordNumber = 0 End If If NOT (rs.BOF AND rs.EOF) Then rs.Move nRecordNumber 'Create New Table Response.Write "" & vbCrLf 'Print Results FOR i = 1 to ( nDisplayItemsPerPage / nDisplayColumnsPerPage ) If rs.EOF Then Exit For End If 'Create New Row Response.Write "" & vbCrLf FOR j = 1 to nDisplayColumnsPerPage 'Create New Column If rs.EOF Then Exit For End if strProductLineCategoryId = rs.Fields("plCategoryId") strProductLineCategoryName = rs.Fields("plCategoryName") strProductLineCategoryThumbnailLocation = rs.Fields("plCategory_Thumbnail_Location") strProductLineCategoryImageLocation = rs.Fields("plCategory_Image_Location") strProductLineCategoryDescriptionUrl= "view_product_line_category_description.asp?product_line_id=" & strProductLineId & "&product_line_category_id=" & strProductLineCategoryId '*********** If IsNull(strProductLineCategoryThumbnailLocation) OR (LEN(TRIM(strProductLineCategoryThumbnailLocation)) <= 0) Then strProductLineCategoryThumbnailLocation = COMING_SOON_THUMBNAIL End If '*********** Response.Write "" & vbCrLf rs.MoveNext NEXT Response.Write "" & vbCrLf NEXT Response.Write "
" & vbCrLf Response.Write "" & vbCrlf Response.Write "" & "
" & strProductLineCategoryName & "
" & vbCrLf Response.Write "
" & vbCrLf Response.Write "

" & vbCrLf End If End Function '************************************************************************* ' Function: getRecordCountByCategories ' Description: obtain the Record Count for Patterns ' Parameters: product line ID ' Returns: the record count '************************************************************************* ' Written by: Wilbert Madarang ' Date: January 25, 2003 '************************************************************************* Function getRecordCountByCategories( strProductLineId ) Dim strSQL, nRecordCount Dim rs 'Check Record Count from the Database strSQL = getSQLCallPerProductLine( strProductLineId ) 'Cannot use ADODB.openConnection Method because this is always a forward only RecordSet 'Use a RecordSet instance instead... '******************************************************** 'Begin of Change - Jan 26, 2003 '******************************************************** 'Call openDataConnection() 'Set rs = dataConnection.Execute( strSQL, adOpenKeyset ) 'Call closeDataConnection() '******************************************************** 'End of change - Jan 26, 2003 '******************************************************** Set rs = server.CreateObject("ADODB.RecordSet") '******************************************************** 'Begin of Change - Jan 30, 2003 '******************************************************** 'The following has been changed because it causes an ODBC error. 'rs.Open strSQL, DATABASE_DRIVER & DATABASE_PATH, adOpenStatic, adLockReadOnly, adCmdTable rs.Open strSQL, DATABASE_DRIVER & DATABASE_PATH, adOpenStatic, adLockReadOnly '******************************************************** 'End of change - Jan 26, 2003 '******************************************************** 'Determine the Record Count If rs.EOF AND rs.BOF Then nRecordCount = 0 Else rs.MoveLast If rs.RecordCount = -1 Then nRecordCount = 0 Else nRecordCount = rs.RecordCount End If End If rs.Close getRecordCountByCategories = nRecordCount End Function '************************************************************************* ' Function: getNumberOfDisplayItemsPerPage ' Description: returns number of display items per page ' Parameters: productLineId ' Returns: String - number of items to display per page ' Written by: Wilbert Madarang ' Date: January 30, 2003 '************************************************************************* Function getNumberOfDisplayItemsPerPage( strProductLineId ) Dim strNumberItemsPerPage SELECT CASE strProductLineId CASE BED_LINEN_COLLECTION strNumberOfItemsPerPage = BED_LINEN_NUMBER_PATTERNS_PER_PAGE CASE DECORATIVE_PILLOWS strNumberOfItemsPerPage = DECORATIVE_PILLOWS_NUMBER_CATEGORIES_PER_PAGE CASE WINDOW_TREATMENT strNumberOfItemsPerPage = WINDOW_TREATMENT_NUMBER_CATEGORIES_PER_PAGE CASE ACCESSORIES strNumberOfItemsPerPage = ACCESSORIES_NUMBER_CATEGORIES_PER_PAGE CASE FURNISHINGS strNumberOfItemsPerPage = FURNISHINGS_NUMBER_CATEGORIES_PER_PAGE END SELECT getNumberOfDisplayItemsPerPage = strNumberOfItemsPerPage End Function '************************************************************************* ' Function: getNumberOfDisplayColumnsPerPage ' Description: returns number of display columns per page ' Parameters: productLineId ' Returns: String - number of items to display columns per page ' Written by: Wilbert Madarang ' Date: January 30, 2003 '************************************************************************* Function getNumberOfDisplayColumnsPerPage( strProductLineId ) Dim strNumberOfColumnsPerPage SELECT CASE strProductLineId CASE BED_LINEN_COLLECTION strNumberOfColumnsPerPage = BED_LINEN_NUMBER_COLUMNS_PER_PAGE CASE DECORATIVE_PILLOWS strNumberOfColumnsPerPage = DECORATIVE_PILLOWS_NUMBER_COLUMNS_PER_PAGE CASE WINDOW_TREATMENT strNumberOfColumnsPerPage = WINDOW_TREATMENT_NUMBER_COLUMNS_PER_PAGE CASE ACCESSORIES strNumberOfColumnsPerPage = ACCESSORIES_NUMBER_COLUMNS_PER_PAGE CASE FURNISHINGS strNumberOfColumnsPerPage = FURNISHINGS_NUMBER_COLUMNS_PER_PAGE END SELECT getNumberOfDisplayColumnsPerPage = strNumberOfColumnsPerPage End Function '************************************************************************* ' Function: getSQLCallPerProductLine ' Description: returns the SQL Call for getting product category of ' interest... ' Parameters: strProductLineId ' Returns: the database table ' Written by: Wilbert Madarang ' Date: January 30, 2003 '************************************************************************* Function getSQLCallPerProductLine ( strProductLineId ) Dim strSQL SELECT CASE strProductLineId CASE BED_LINEN_COLLECTION strSQL = "SELECT * FROM dirPatterns ORDER BY viewOrder" CASE DECORATIVE_PILLOWS strSQL = "SELECT * FROM dirProductLineCategories WHERE plId=" & strProductLineId & " ORDER BY viewOrder" CASE WINDOW_TREATMENT strSQL = "SELECT * FROM dirProductLineCategories WHERE plId=" & strProductLineId & " ORDER BY viewOrder" CASE ACCESSORIES strSQL = "SELECT * FROM dirProductLineCategories WHERE plId=" & strProductLineId & " ORDER BY viewOrder" CASE FURNISHINGS strSQL = "SELECT * FROM dirProductLineCategories WHERE plId=" & strProductLineId & " ORDER BY viewOrder" END SELECT getSQLCallPerProductLine = strSQL End Function %>