"
If strProductLineId = 1 Then
Response.Write " REQUEST fabric swatch / catalogue "
End If
End Function
'*************************************************************************
' Function: PrintProductsByPatternSortBySize()
' Description: prints the products by pattern provided
' Parameters: none
' Returns: none
' Written by: Wilbert Madarang
' Date: February 4, 2003
'*************************************************************************
' Modified: March 22, 2003
' Modified constraint of query so that results of search
' 1. Returns even non product line items, as long as they
' Have the same Pattern
'*************************************************************************
' Modified: March 29, 2003
'
' Query STATEMENT
' 1. Added SORT ORDER to strConstraint - SORT BY DESCending ORDER
' 2. remove 'DISTINCT' FROM 'SELECT DISTINC' Query clause
'
' DISPLAY Parameters
' 3. Added Bold Attributes to strProductName.
' 4. Display Product Code instead of Product ID
' 5. Added Font Color Attributes to strProductCode
' 6. Changed logic for displaying Sale price
' - don't use LEN(strProductSalePrice) > 0
' 7. Changed field names for currency to nProductSalePrice, nProductRegularPrice
' from strProductSalePrice, strProductRegularPrice
'*************************************************************************
' Modified: October 19, 2003
' 1. Added sizeId DESC to SORT ORDER
'*************************************************************************
Function PrintProductsByPatternSortBySize( strProductLineId, strSizeId )
Dim strSQL, strTable, strConstraint, strLocalPatternId, rs
Dim strCurrencyLabel
Dim nProductPrice
'Prepare Currency Label
strCurrencyLabel = getCurrencyLabel()
'Prepare SQL statements
strRegularPriceFieldName = getRegularPriceFieldName() 'US or Cdn Price
strSalePriceFieldName = getSalePriceFieldName() 'US or Cdn Price
'********************************************************************
'Start of Modification by WM -March 22, 2003
'********************************************************************
'strConstraint = " WHERE productLineId=" & strProductLineId & _
' " AND patternId=" & strPatternId & _
' " AND (sizeId=" & strSizeId & " OR sizeId IS NULL OR sizeId=0 ) "
'********************************************************************
'End of Modification by WM -March 22, 2003
'********************************************************************
' Addendum by WM on March 29, 2003
' 1. Added SORT ORDER to strConstraint - SORT BY DESCending ORDER
' 2. remove 'DISTINCT' FROM 'SELECT DISTINC' clause
'********************************************************************
' End of Addendum by WM -March 29, 2003
'********************************************************************
' Addendum by WM on April 1, 2003
' 1. Added SORT ORDER to sort by productCode
'********************************************************************
' End of Addendum by WM - April 1, 2003
'********************************************************************
' Addendum by WM on November 1, 2003
' 1. CR to sort by sizeId, productLineCategoryId, productCode
'********************************************************************
' End of Addendum by WM - November 1, 2003
'********************************************************************
' Addendum by WM on November 5, 2003
' Request is to sort by ProductLineId, not productLineCategoryId
' 1. CR to sort by sizeId, productLineId, productCode
'********************************************************************
' End of Addendum by WM - November 5, 2003
'********************************************************************
strConstraint = " WHERE patternId=" & strPatternId
'ay051605 comment out next 3 lines for Lifestyles Accessories
' strConstraint = " WHERE patternId=" & strPatternId & _
' " AND (sizeId=" & strSizeId & " OR sizeId IS NULL OR sizeId=0 ) " & _
' "ORDER BY sizeId DESC, productLineId, productCode"
'"ORDER BY sizeId DESC, productLineCategoryId, productCode"
'" ORDER BY sizeId DESC, productCode"
'" ORDER BY sizeId DESC"
'ay051605 add below for Lifestyles Accessories
If strProductLineId = 7 Then
strConstraint = strConstraint + " AND productLineId=7"
End If
strConstraint = strConstraint + " AND (sizeId=" & strSizeId & " OR sizeId IS NULL OR sizeId=0 )"
strConstraint = strConstraint + " ORDER BY sizeId DESC, productLineId, productCode"
'********************************************************************
' Modified by WM - October 19, 2003
' 1. Added sizeId DESC to Ordering of Query
'********************************************************************
strColumnNames = " productId, productCode, productName, " & strRegularPriceFieldName & "," & strSalePriceFieldName
strTable = "dirProducts"
strSQL = "SELECT " & strColumnNames & " FROM " & strTable & strConstraint
'Open Data Connections
Call openDataConnection()
Set rs = dataConnection.Execute( strSQL )
Call closeDataConnection()
'Write Main Product Header
Response.Write "
" & vbCrLf
Response.Write "
" & vbCrLf
Response.Write "
" & vbCrLf
If strProductLineId = 0 Then
Response.Write "Bed Linen Collection" & vbCrLf
' ay051605 update for lifestyles accessories
Elseif strProductLineId = 7 Then
Response.Write "Lifestyles Accessories" & vbCrLf
End If
Response.Write "
" & vbCrLf
Call AddLinkToCart()
Response.Write "
" & vbCrLf
Call PrintSizeSelectionHeading( strSizeId )
'Write Query Headers in Table Format
Response.Write "
" & vbCrLf
Response.Write "
" & vbCrLf
Response.Write "
Items
" & vbCrLf
Response.Write "
Colors
" & vbCrLf
Response.Write "
Quantity
" & vbCrLf
Response.Write "
Add to Cart
" & vbCrLf
Response.Write "
" & vbCrLf
'Show Query Results
DO WHILE NOT rs.EOF
'************************************************************************
' Modified by WM - March 29, 2003
'************************************************************************
' 1. Added Bold Attributes to strProductName.
' 2. Display Product Code instead of Product ID
' 3. Added Font Color Attributes to strProductCode
' 4. Changed field names for currency to nProductSalePrice, nProductRegularPrice
' from strProductSalePrice, strProductRegularPrice
' 5. Changed logic for displaying Sale price
' - don't use LEN(strProductSalePrice) > 0
' - use (nProductSalePrice) > 0
'************************************************************************
'Obtain Fields
strProductId = rs.Fields("productId")
strProductCode = rs.Fields("productCode")
strProductName = rs.Fields( "productName" )
nProductRegularPrice = rs.Fields( strRegularPriceFieldName )
nProductSalePrice = rs.Fields( strSalePriceFieldName )
nProductPrice = getProductPrice( nProductRegularPrice, nProductSalePrice )
'Define Form
Response.Write "" & vbCrLf
rs.MoveNext
LOOP
Response.Write "
" & vbCrLf
Response.Write "
" & vbCrLf
Response.Write "
" & vbCrLf
Call AddLinkToCart()
Response.Write "
" & vbCrLf
Response.Write "
" & vbCrLf
End Function
'*************************************************************************
' Function: PrintSizeSelectionHeading
' Description: prints a Heading Where User can Select Size
' Parameters: strSizeId
' Returns: none
' Written by: Wilbert Madarang
' Date: March 15, 2003
'*************************************************************************
Function PrintSizeSelectionHeading( strSizeId )
Dim strSQL, strTable, strConstraint, strLocalPatternId, rs, strSizeSelectionLink
Dim strLocalSizeId, strSizeName
'Prepare SQL Statement
strSQL = "SELECT * FROM dirSizes ORDER BY sizeId"
Call openDataConnection()
Set rs = dataConnection.Execute( strSQL )
Call closeDataConnection()
Response.Write "
" & vbCrLf
End Function
'*************************************************************************
' Function: PrintColorSelectionListByProduct()
' Description: prints the products by pattern provided
' Parameters: none
' Returns: none
' Written by: Wilbert Madarang
' Date: February 4, 2003
'*************************************************************************
' Modified by WM - November 1, 2003
'************************************************************************
' 1. Added color as a hidden web parameter into the shopping cart form.
'************************************************************************
Function PrintColorSelectionListByProduct( strProductId )
Dim strSQL, strTable, strConstraint, rs, strUrl
'Prepare SQL
strConstraint = " WHERE rel_Product_Color.productId=" & strProductId
strTable = "rel_Product_Color INNER JOIN dirColors ON rel_Product_Color.colorId=dirColors.colorId"
strSQL = "SELECT rel_Product_Color.colorId, dirColors.colorName FROM " & strTable & strConstraint
'Call SQL Statement
Call openDataConnection()
Set rs = dataConnection.Execute( strSQL )
Call closeDataConnection()
'Assess if there are Records
If rs.EOF AND rs.BOF Then
Response.Write " " & vbCrLf
Exit Function
End If
'Print Colors Selection List
Response.Write "" & vbCrLf
End Function
'*************************************************************************
' Function: getRegularPriceFieldName
' Description: gets the Regular Price FieldName
' Parameters: none
' Returns: none
' Written by: Wilbert Madarang
' Date: February 8, 2003
'*************************************************************************
' Modified: November 8, 2003
' Changed references from "MyCountry" to "MyCurrency"
'*************************************************************************
Function getRegularPriceFieldName
Dim strFieldName
If session( "MyCurrency" ) = "canada" Then
strFieldName = "product_Reg_Price_Cdn"
Else
strFieldName = "product_Reg_Price_US"
End If
getRegularPriceFieldName = strFieldName
End Function
'*************************************************************************
' Function: getSalePriceFieldName
' Description: gets the Sale Price FieldName
' Parameters: none
' Returns: the Field Name, in either US or Canadian Currency
' Written by: Wilbert Madarang
' Date: February 8, 2003
'*************************************************************************
' Modified: November 8, 2003
' Changed references from "MyCountry" to "MyCurrency"
'*************************************************************************
Function getSalePriceFieldName
Dim strFieldName
If session( "MyCurrency" ) = "canada" Then
strFieldName = "product_Sale_Price_Cdn"
Else
strFieldName = "product_Sale_Price_US"
End If
getSalePriceFieldName = strFieldName
End Function
'*************************************************************************
' Function: getCurrencyLabel
' Description: gets Currency Label
' Parameters: none
' Returns: returns Currency Label
' Written by: Wilbert Madarang
' Date: March 16, 2003
'*************************************************************************
' Modified: November 8, 2003
' Changed references from "MyCountry" to "MyCurrency"
'*************************************************************************
Function getCurrencyLabel
Dim strCurrency, strCurrencyLabel
'Obtain the Session Information
strCurrency = Session("MyCurrency")
If strCurrency = "" OR IsNull( strCurrency ) Then
strCurrency = DEFAULT_COUNTRY
End If
'Get Currency Label
If strCurrency = "canada" Then
strCurrencyLabel = CURRENCY_LABEL_CANADIAN
Else
strCurrencyLabel = CURRENCY_LABEL_US
End If
getCurrencyLabel = strCurrencyLabel
End Function
'*************************************************************************
' Function: getProductPrice
' Description: gets the Product Price
' Parameters: regular price, sale price
' Returns: returns the price
' Written by: Wilbert Madarang
' Date: May 7, 2003
'*************************************************************************
Function getProductPrice( nProductRegularPrice, nProductSalePrice )
Dim nProductPrice
If ( nProductSalePrice ) > 0 Then
nProductPrice = nProductSalePrice
Else
nProductPrice = nProductRegularPrice
End If
getProductPrice = nProductPrice
End Function
'*************************************************************************
' Function: AddLinkToCart
' Description: Adds a Link to the Shopping Cart
' Parameters: regular price, sale price
' Returns: returns the price
' Written by: Wilbert Madarang
' Date: May 7, 2003
'*************************************************************************
Function AddLinkToCart
Response.Write "