<%@ LANGUAGE="VBSCRIPT" %> <% PageStrings = "545, 1154, 1160, 1162, 1165, 1166, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1198, 1199, 1200" strThisBackPage = "config" %> <% '=============================================== ' CactuShop ASP Shopping Cart ' ©1999-2004 Cactusoft Ltd. www.cactusoft.com '=============================================== ' All rights reserved. ' Use of this code is covered by the terms and ' conditions in the license agreement. No ' unauthorized duplication or distribution is ' permitted. Cactusoft's copyright notices must ' remain in the ASP sections of the code. '=============================================== '----------------------------------------------- 'GET FORM VALUES 'Get the form values, and make sure they're in 'the correct state '----------------------------------------------- blnProcess = (request.Form("strProcess") = "y") 'Whether to actually process the changes strChange = request.Form("strChange") 'value of change strChangeType = request.Form("strChangeType") 'perc or curr If not isnumeric(strChange) then numChange = 0 else numChange = CDbl(strChange) If blnProcess then '----------------------------------------------- ' PROCESSING ' Get IDs to alter '----------------------------------------------- V_IDs = request.Form("V_ID") else '----------------------------------------------- ' CONFIRMING ' Get and validate the rest of the settings '----------------------------------------------- strFromPrice = request.Form("strFromPrice") 'Min of price range strToPrice = request.Form("strToPrice") 'Max of price range numCategory = request.Form("numCategory") 'Category to look in. 0 for all. strChangeDirection = request.Form("strChangeDirection") 'Marking up or down 'Check validity of values - force them to be valid If not isnumeric(strFromPrice) then numFromPrice = 0 else numFromPrice = CDbl(strFromPrice) If not isnumeric(strToPrice) then numToPrice = 0 else numToPrice = CDbl(strToPrice) 'If numToPrice has been set but is too low, set it 'to the same as the From price If numToPrice > 0 and numToPrice < numFromPrice then numToPrice = numFromPrice If numChangeType = "perc" then If numChange > 100 then numChange = 100 ElseIf numChange < 0 then numChange = 0 End IF Else If numChange < 0 then numChange = 0 end if end if end if %> <% =GetString("Config_headtitle") %>
<% If blnProcess then '*********************************************** ' MAKING THE CHANGES '*********************************************** If V_IDs = "" then %> <% else If strChangeType = "perc" then strNewValue = "V_Price + (V_Price * " & numChange / 100 & ")" else strNewValue = "V_Price + " & numChange end if strQuery = "UPDATE tblCactuShopVersions SET V_Price=" & strNewValue & " WHERE V_ID IN (" & V_IDs & ")" Call ExecuteSQL(strQuery, numCursorType, objRecordSet) %> <% end if '// no V_IDs were selected from the checkboxes. else '*********************************************** ' CONFIRMING THE CHANGES '*********************************************** '----------------------------------------------- 'BUILD UP QUERY 'And the accompanying text string '----------------------------------------------- 'Start the query strQuerySelect = "SELECT DISTINCT " For numCounter = 1 to numTotalLanguages: strQuerySelect = strQuerySelect & "tblCactuShopVersions.V_Name" & CStr(numCounter) & ", tblCactuShopProducts.P_Name" & CStr(numCounter) & ", ": Next strQuerySelect = strQuerySelect & "V_Price, V_ID FROM (tblCactuShopVersions INNER JOIN tblCactuShopProducts ON tblCactuShopVersions.V_Product = tblCactuShopProducts.P_ID) INNER JOIN tblCactuShopProductProdTypeLink ON tblCactuShopProducts.P_ID = tblCactuShopProductProdTypeLink.PPT_ProductID WHERE (1=1)" 'Direction If strChangeDirection = "up" then strAction = GetString("ContentText_Markup") else strAction = GetString("ContentText_Markdown") end if 'Price boundaries If numFromPrice > 0 then If numToPrice > 0 then strAction = strAction & " " & GetString("ContentText_VersionsBetween") & " " & strDefaultCurrencySymbol & " " & CurrencyDisplay(numFromPrice, 1, blnDefaultCurrencyHasDecimals) & " " & GetString("ContentText_PriceRangeAnd") & " " & strDefaultCurrencySymbol & " " & CurrencyDisplay(numToPrice, 1, blnDefaultCurrencyHasDecimals) strQuerySelect = strQuerySelect & " AND (V_Price >= " & numFromPrice & ") AND (V_Price <= " & numToPrice & ")" Else strAction = strAction & " " & GetString("ContentText_VersionsAbove") & " " & strDefaultCurrencySymbol & " " & CurrencyDisplay(numFromPrice, 1, blnDefaultCurrencyHasDecimals) strQuerySelect = strQuerySelect & " AND (V_Price >= " & numFromPrice & ")" end if elseif numToPrice > 0 then strAction = strAction & " " & GetString("ContentText_VersionsBelow") & " " & strDefaultCurrencySymbol & " " & CurrencyDisplay(numToPrice, 1, blnDefaultCurrencyHasDecimals) strQuerySelect = strQuerySelect & " AND (V_Price <= " & numToPrice & ")" else strAction = strAction & " " & GetString("ContentText_AllVersions") end if 'Category If numCategory > 0 then '----------------------------------------------- 'GET THE CATEGORY NAME 'We have to pull it out from the database then 'loop around to find the right language '----------------------------------------------- strQuery = "SELECT " For numCounter = 1 to numTotalLanguages: strQuery = strQuery & "tblCactuShopProdtype.PT_Name" & CStr(numCounter) & ", ": Next strQuery = strQuery & "tblCactuShopProdtype.PT_ID FROM tblCactuShopProdtype WHERE PT_ID = " & numCategory Call ExecuteSQL(strQuery, numCursorType, objRecordSet) strCategoryName = objRecordSet("PT_Name" & CStr(numLanguageID)) if strCategoryName & "" = "" then For numCounter = 1 to numTotalLanguages strCategoryName = objRecordSet("PT_Name" & CStr(numCounter)) if strCategoryName & "" <> "" then exit for next end if objRecordSet.Close strAction = strAction & " " & GetString("ContentText_InCategory") & " '" & strCategoryName & "'" strQuerySelect = strQuerySelect & " AND (tblCactuShopProductProdTypeLink.PPT_ProdTypeID = " & numCategory & ")" end if 'Modification type If strChangeType = "perc" then strAction = strAction & " " & GetString("ContentText_MarkUpBy") & " " & CStr(numChange) & "%" else strAction = strAction & " " & GetString("ContentText_MarkUpBy") & " " & strDefaultCurrencySymbol & " " & CurrencyDisplay(numChange, 1, blnDefaultCurrencyHasDecimals) end if strQuerySelect = strQuerySelect & " ORDER BY V_ID" 'Now that's all done - we want to set the Change value 'to negative if we're marking down. Means we can then 'ignore 'direction' If strChangeDirection = "down" then numChange = -numChange 'Execute the query! Call ExecuteSQL(strQuerySelect, numCursorType, objRecordSet) If objRecordSet.BOF And objRecordSet.EOF then %> <% else %> <% End If '// recordset not bof and eof objRecordSet.Close End If '// the processing/confirming selection %>
<% WriteString("PageTitle_MarkupPrices") %>
<% WriteString("ContentText_MarkupNoneSelected") %>
<% WriteString("ContentText_ModificationsMade") %>
<% WriteString("ContentText_NoPricesMarkup") %>
<%= strAction %>
<% WriteString("ContentText_MarkupConfirmText") %>
<% '----------------------------------------------- 'LOOP THROUGH THE QUERY '----------------------------------------------- Do While not objRecordSet.Eof 'Calculate new price V_Price = objRecordSet("V_Price") If strChangeType = "perc" then numNewPrice = V_Price + (V_Price * (numChange / 100)) else numNewPrice = V_Price + numChange end if 'Get product name strProductName = objRecordSet("P_Name" & CStr(numLanguageID)) If strProductName & "" = "" then numCounter = 0 for numCounter = 1 to numTotalLanguages strProductName = objRecordSet("P_Name" & CStr(numCounter)) If strProductName & "" <> "" then exit for next end if If len(strProductName) > 30 then strProductName = left(strProductName, 24) & "..." 'Get version name strVersionName = objRecordSet("V_Name" & CStr(numLanguageID)) If strVersionName & "" = "" then numCounter = 0 for numCounter = 1 to numTotalLanguages strVersionName = objRecordSet("V_Name" & CStr(numCounter)) If strVersionName & "" <> "" then exit for next end if If len(strVersionName) > 20 then strVersionName = left(strVersionName, 14) & "..." 'Build strItemName strItemName = strProductName & " (" & strVersionName & ")" 'Alternate background colour numBackgroundCounter = numBackgroundCounter + 1 If numBackgroundCounter Mod 2 = 0 Then strBgColour="#EEEEEE" Else strBgColour="#DDDDDD" %> <% objRecordSet.MoveNext Loop %>
<% WriteString("ContentText_ProductAndVersion") %> <% WriteString("ContentText_Price") %> <% WriteString("ContentText_NewPrice") %>
<%= strItemName %> <%= strDefaultCurrencySymbol & " " & CurrencyDisplay(V_Price, 1, blnDefaultCurrencyHasDecimals) %> <%= strDefaultCurrencySymbol & " " & CurrencyDisplay(numNewPrice, 1, blnDefaultCurrencyHasDecimals) %> " checked="checked">
">
<% objDataConn.Close set objDataConn = nothing %>