<%@ LANGUAGE="VBSCRIPT" %> <% PageStrings = "400, 517, 524, 525, 538, 539, 540, 541, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 589, 622, 864, 832, 865, 935, 936, 937, 938, 1213, 1214, 1234" strThisBackPage = "products" %> <% '=============================================== ' 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. '=============================================== '----------------------------------------------- 'MODIFY VERSION SCRIPT 'This enables versions to be pulled out of the 'database, into a form and edited. It is also 'called for new versions - in this case the 'text box and dropdown settings are blanked. '----------------------------------------------- '----------------------------------------------- 'COLLECT VALUES FROM QUERYSTRING '----------------------------------------------- V_ID = Request.Querystring("V_ID") P_ID = Request.Querystring("P_ID") PT_ID = Request.Querystring("PT_ID") numOriginalProdType = PT_ID If P_ID = "" Or Not IsNumeric(P_ID) Then P_ID = 0 strCallMode = Request.Querystring("strCallMode") '----------------------------------------------- 'FORMAT AND RUN THE QUERY '----------------------------------------------- strQuery = "SELECT tblCactuShopVersions.*, PT_ID FROM ((tblCactuShopVersions INNER JOIN tblCactuShopProducts ON tblCactuShopVersions.V_Product = tblCactuShopProducts.P_ID) INNER JOIN tblCactuShopProductProdTypeLink ON tblCactuShopProducts.P_ID = tblCactuShopProductProdTypeLink.PPT_ProductID) INNER JOIN tblCactuShopProdtype ON tblCactuShopProductProdTypeLink.PPT_ProdTypeID = tblCactuShopProdtype.PT_ID WHERE V_ID = " & V_ID Call ExecuteSQL(strQuery, numCursorType, objRecordSet) numRecordCount = objRecordSet.RecordCount '----------------------------------------------- 'If a version has been pulled out of the DB then 'set these variables to the field info that was 'pulled out, otherwise this is a new version and 'the variables will be left blank. '----------------------------------------------- Dim V_Name(), V_Desc() Redim V_Name(numTotalLanguages) Redim V_Desc(numTotalLanguages) If numRecordCount > 0 then V_ID = objRecordSet("V_ID") V_Live = objRecordSet("V_Live") V_CodeNumber = SafeHTMLencode(objRecordSet("V_CodeNumber")) V_Product = objRecordSet("V_Product") V_Price = objRecordSet("V_Price") V_RRP = objRecordSet("V_RRP") V_Weight = objRecordSet("V_Weight") V_DeliveryTime = objRecordSet("V_DeliveryTime") V_Quantity = objRecordSet("V_Quantity") V_QuantityWarnLevel = objRecordSet("V_QuantityWarnLevel") V_DownLoadInfo = SafeHTMLencode(objRecordSet("V_DownLoadInfo")) V_DownloadType = objRecordSet("V_DownLoadType") V_Tax = objRecordSet("V_Tax") V_OrderByValue = objRecordSet("V_OrderByValue") 'Set an array extension if the download file was uploaded If V_DownloadType = "u" then aryDownloadInfo = split(V_DownloadInfo, "|") strDownloadExtension = aryDownloadInfo(0) strRandomFileName = aryDownloadInfo(1) 'Make the extension into an array so we can pass it to 'our function Dim aryDownloadExtension(0) aryDownloadExtension(0) = strDownloadExtension ElseIf V_DownloadType = "f" then V_FreeShipping = "y" End If 'Loop through all languages and get the names and descriptions For numCounter = 1 to numTotalLanguages If aryLangLiveBack(numCounter) = "y" then V_Name(numCounter) = SafeHTMLencode(objRecordSet("V_Name" & CStr(numCounter))) V_Desc(numCounter) = SafeHTMLencode(objRecordSet("V_Desc" & CStr(numCounter))) If V_Name(numCounter) <> "" then strFirstNonEmptyName = V_Name(numCounter) end if end if Next If V_Name(numDefaultLanguage) <> "" then strFirstNonEmptyName = V_Name(numDefaultLanguage) If V_Live= "" Then V_Live = "n" If PT_ID = "" Then PT_ID = objRecordSet("PT_ID") Else V_ID = 0 V_Tax = 0 V_Product = P_ID End If objRecordSet.Close '----------------------------------------------- 'This seems to be the most reliable way of 'converting to a number - "" will change to zero '----------------------------------------------- PT_ID = PT_ID * 1 V_Product = V_Product * 1 If V_Product = 0 Then V_Product = Product * 1 %> <% =GetString("Config_headtitle") %>
<% '----------------------------------------------- 'LOOKUP VERSION 'If a version has been pulled out of the DB then 'run this query to find the product and set 'some more variables to these values. '----------------------------------------------- If numRecordCount > 0 Then strQuery = "SELECT * FROM tblCactuShopVersions INNER JOIN tblCactuShopProducts ON tblCactuShopVersions.V_Product = tblCactuShopProducts.P_ID WHERE V_ID = " & V_ID Call ExecuteSQL(strQuery, numCursorType, objRecordSet) P_Name = SafeHTMLencode(objRecordSet("P_Name" & CStr(numLanguageID))) If P_Name & "" = "" then For numCounter = 1 to numTotalLanguages if aryLangLiveBack(numCounter) = "y" then P_Name = SafeHTMLencode(objRecordSet("P_Name" & CStr(numCounter))) If P_Name & "" <> "" then Exit For end if next end if objRecordSet.Close If strCallMode = "c" then strPageTitle = GetString("PageTitle_CloneVersion") Else strPageTitle = GetString("PageTitle_EditVersion") End If Else strPageTitle = GetString("PageTitle_NewVersion") End If If strCallMode = "c" Then V_ID = 0 %>
<% Response.Write(strPageTitle & " " & P_Name) %>
<% If numOriginalProdType = "" then numOriginalProdType = PT_ID %> "> <% For numCounter = 1 to numTotalLanguages If aryLangLiveBack(numCounter) = "y" then if numTotalLanguages > 1 then if numCounter = 1 then %> <% end if %> <% end if %> <% if numTotalLanguages > 1 then %> <% end if %> <% end if next %> <% '----------------------------------------- 'DOWNLOADABLE VERSION SECTION '----------------------------------------- %> <% 'If we're not editing and the file was found, we can delete it If Not V_ID = 0 And Not strFileName = "" then %> <% End If %> <% '----------------------------------------- 'DOWNLOADABLE VERSION SECTION END '----------------------------------------- %>
<% WriteString("FormLabel_ShowOnSite") %> checked="true" <% End If %>type="checkbox" name="V_Live" value="y">
<% WriteString("FormLabel_CodeNumer") %>
<% WriteString("FormLabel_Product") %> <% '----------------------------------------------- 'Build product dropdown menu from DB query '----------------------------------------------- strQuery = "SELECT * FROM tblCactuShopProducts INNER JOIN tblCactuShopProductProdTypeLink ON tblCactuShopProducts.P_ID = tblCactuShopProductProdTypeLink.PPT_ProductID WHERE PPT_ProdTypeID = " & PT_ID & " OR P_ID=" & V_Product & " ORDER BY P_Name" & CStr(numLanguageID) Call ExecuteSQL(strQuery,numCursorType,objRecordSet) Call SingleDropDownLang("V_Product", "", GetString("FormButton_Select") & ":", objRecordSet, "P_ID", "P_Name", V_Product) objRecordSet.Close %>

<%= aryLangBackNames(numCounter) %>
<% WriteString("FormLabel_VersionName") %>
<% WriteString("FormLabel_DescriptionNotRequired") %>

<% If Application(LICENSENUMBER & "pricesinctax") = "y" then WriteString("FormLabel_PriceIncTax") Else WriteString("FormLabel_PriceExTax") End if %> <% Response.Write(strDefaultCurrencySymbol) %>
<% WriteString("FormLabel_RRP") %> <% Response.Write(strDefaultCurrencySymbol) %>
<% WriteString("FormLabel_Weight") %> (<% Response.Write(Application(LICENSENUMBER & "weightunit")) %>)
<% WriteString("FormLabel_TaxBand") %> <% '----------------------------------------------- 'BUILD TAX RATE DROPDOWN 'Can't use function since we want more than the 'contents of one DB field displayed on the 'each line of the dropdown. '----------------------------------------------- strQuery = "SELECT * FROM tblCactuShopTaxRates" Call ExecuteSQL(strQuery, numCursorType, objRecordSet) strMenu="" response.write(strMenu) objRecordSet.Close %>
<% WriteString("FormLabel_DeliveryTime") %>
<% WriteString("FormLabel_StockQuantity") %>  <% WriteString("FormLabel_WarningLevel") %> 
<% WriteString("ContentText_StockQuantityText") %>
<% WriteString("FormLabel_OrderByValue") %>
<% WriteString("FormLabel_FreeShipping") %> >
<% WriteString("ContentText_FreeShippingText") %>

<% WriteString("ContentText_DownloadableFile") %>
<% WriteString("ContentText_DownloadableFileExp") %>
<% WriteString("FormLabel_DownLoadURL") %> ">
<% WriteString("ContentText_OrUploadFile") %> <% '----------------------------------------- 'FIND AND EXISTING FILE (IF ANY) '----------------------------------------- 'If we currently have a file uploaded and we're not adding a new version... If V_Downloadtype = "u" And strCallMode <> "new" Then 'See if the file exists Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject") strFileName = GetFileLocation(Server.MapPath(Application(LICENSENUMBER & "uploadsfolder") & "files_versions/"), V_ID & "_" & strRandomFileName, aryDownloadExtension, objFileSystem) If strFileName = "" Then strFileStatus = "" Else strFileLocation = Application(LICENSENUMBER & "uploadsfolder") & "files_versions/" & strFileName strFileStatus = "." & strDownloadExtension & " file" End if Else strFileStatus = "" End If '----------------------------------------- 'SHOW UPLOADER BOX '----------------------------------------- %>
  <% Response.Write(strFileStatus) %> <% WriteString("ContentText_TickHereToRemoveFile") %>

<% WriteString("ContentText_NormalImage") %>
<% '----------------------------------------- 'FIND AND SHOW EXISTING IMAGE (IF ANY) '----------------------------------------- If Not strCallMode = "new" Then Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject") strFileName = GetFileLocation(Server.MapPath(Application(LICENSENUMBER & "uploadsfolder") & "images_versions/"), V_ID, Split(Application(LICENSENUMBER & "allowedimages"), ","), objFileSystem) If strFileName = "" Then strFileStatus = GetString("ContentText_NoImagePresent") Else strFileStatus = "
" End if End If '----------------------------------------- 'HANDLE LOGO DISPLAY AND UPLOADER BOX '----------------------------------------- Response.Write(strFileStatus) %>
<% If Not V_ID = 0 And Not strFileName = "" Then %> <% WriteString("ContentText_TickHereToRemoveImage") %> <% End If %>

<% WriteString("ContentText_LargeImage") %>
<% '----------------------------------------- 'FIND AND SHOW EXISTING IMAGE (IF ANY) '----------------------------------------- If Not strCallMode = "new" Then strFileName = GetFileLocation(Server.MapPath(Application(LICENSENUMBER & "uploadsfolder") & "images_versions_large/"), V_ID, Split(Application(LICENSENUMBER & "allowedimages"), ","), objFileSystem) If strFileName = "" Then strFileStatus = GetString("ContentText_NoImagePresent") Else strFileStatus = "
" End if Set objFileSystem = Nothing End If '----------------------------------------- 'HANDLE LOGO DISPLAY AND UPLOADER BOX '----------------------------------------- Response.Write(strFileStatus) %>
<% If Not V_ID = 0 And Not strFileName= "" Then %> <% WriteString("ContentText_TickHereToRemoveImage") %> <% End If %>
  <% WriteString("FormButton_Update") %> <% Else %> <% WriteString("FormButton_Add") %> <% End If %>">

<% '----------------------------------------------- 'Show the delete version on if this is an 'existing version. '----------------------------------------------- If Not V_ID = 0 Then %>
"> <% WriteString("ContentText_DeleteThisVersion") %>
<% End If %>
<% objDataConn.Close Set objDataConn = Nothing %>