<% Option Explicit If not Session("isLoggedIn") Then response.redirect("/ecommerce/default.asp?returnUrl=" & Server.URLEncode(Request.ServerVariables("SCRIPT_NAME"))) End If %> <% Dim intUserID, strUsername, intUserTypeID, intOrderTypeID, intItemID, dblDefaultPrice, dblCustomPrice Dim strSortCat, strSortOrder, strOldSortOrder Dim rsItem, arrDBItemData, arrDBCustomData, arrDBItemCatData, strSQL Dim iItemFirst, iItemLast, iCustomFirst, iCustomLast, iItemCatFirst, iItemCatLast Dim I, J Dim intItemCategoryID arrDBItemData = null arrDBCustomData = null arrDBItemCatData = null strSortCat = "" strSortOrder = "" strOldSortOrder = "" If Request("sortCat") <> "" Then strSortCat = CStr(Request("sortCat")) If Request("sortOrder") <> "" Then strSortOrder = CStr(Request("sortOrder")) If strSortCat = "" Then strSortCat = "itemID" If strSortOrder = "" Then strSortOrder = "ASC" intItemCategoryID = 0 If Request.Form("itemCategoryID") <> "" Then intItemCategoryID = CInt(Request.Form("itemCategoryID")) intUserID = 0 If Request.Form("userID") <> "" Then intUserID = CInt(Request.Form("userID")) strUsername = "" If Request.Form("username") <> "" Then strUsername = CStr(Request.Form("username")) intUserTypeID = 0 If Request.Form("userTypeID") <> "" Then intUserTypeID = CInt(Request.Form("userTypeID")) intItemID = 0 If Request.Form("itemID") <> "" Then intItemID = CInt(Request.Form("itemID")) dblDefaultPrice = 0 If Request.Form("defaultPrice") <> "" Then dblDefaultPrice = CDbl(Request.Form("defaultPrice")) dblCustomPrice = 0 If Request.Form("customPrice") <> "" Then dblCustomPrice = CDbl(Request.Form("customPrice")) If intUserTypeID = 5 Then intOrderTypeID = 3 If intUserTypeID = 4 Then intOrderTypeID = 2 If Request.Form("isSubmitted") Then If dblCustomPrice <> 0 Then If dblDefaultPrice = dblCustomPrice Then ' erase the custom price strSQL = "EXEC stpCustomPriceDelete " & intItemID & ", " & intUserID Else ' enter the custom price (stp updates/inserts as necessary) strSQL = "EXEC stpCustomPriceUpdate " & intItemID & ", " & intOrderTypeID & ", " & intUserID & ", " & dblCustomPrice End If 'dblDefaultPrice = dblDefaultPrice dbconn.Execute(strSQL) End If 'dblCustomPrice <> 0 End If ' custom prices strSQL = "EXEC stpItemPriceSelectAll " & intOrderTypeID & ", " & intUserID & ", " & intItemCategoryID Set rsItem = Server.CreateObject("ADODB.Recordset") rsItem.CursorLocation = 3 rsItem.Open strSQL, dbconn, 3, 3 rsItem.Sort = strSortCat & " " & strSortOrder If rsItem.EOF Then strErrMsg = "
  • no items
  • " isErr = true Else arrDBCustomData = rsItem.GetRows() iCustomFirst = LBound(arrDBCustomData, 2) iCustomLast = UBound(arrDBCustomData, 2) End If ' not EOF rsItem.Close Set rsItem = Nothing ' ordinary prices strSQL = "EXEC stpItemPriceSelectAll " & intOrderTypeID & ", " & 1 & ", " & intItemCategoryID Set rsItem = Server.CreateObject("ADODB.Recordset") rsItem.CursorLocation = 3 rsItem.Open strSQL, dbconn, 3, 3 rsItem.Sort = strSortCat & " " & strSortOrder If rsItem.EOF Then strErrMsg = "
  • no items
  • " isErr = true Else arrDBItemData = rsItem.GetRows() iItemFirst = LBound(arrDBItemData, 2) iItemLast = UBound(arrDBItemData, 2) End If ' not EOF rsItem.Close Set rsItem = Nothing ' fix the sort order strOldSortOrder = strSortOrder If strSortOrder = "ASC" Then strSortOrder = "DESC" Else strSortOrder = "ASC" End If strSQL = "EXEC stpItemCategorySelectAll 1" Set rsItem = dbconn.Execute(strSQL) If rsItem.EOF Then strErrMsg = "
  • no items
  • " isErr = true Else arrDBItemCatData = rsItem.GetRows() iItemCatFirst = LBound(arrDBItemCatData, 2) iItemCatLast = UBound(arrDBItemCatData, 2) End If ' not EOF rsItem.Close Set rsItem = Nothing %> Galuku Cocopeat

    Customise Prices for <%= strUsername %>

    Display:
    Sorted by <%= strSortCat %> in <%= LCase(strOldSortOrder) %>ending order

    <% If Session("intUserTypeID") = 1 Then %> <% End If %> <% If not isNull(arrDBItemData) Then For I = iItemFirst To iItemLast 'itemID, itemName, itemDesc, isActive, itemCategoryDesc %> <% Else %><%= "AA" %><% End If %>"> <% Next End If %>
    Item ID Item name Item description Item category  
    <%= arrDBItemData(0,I) %> <%= arrDBItemData(1,I) %> <%= arrDBItemData(2,I) %> <%= arrDBItemData(4,I) %> <%= FormatCurrency(arrDBItemData(7,I)) %> set

    Return to User Edit

     

    ^ back to top