%@ 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 %>
| <%
'-----------------------------------------------
'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
%>
<% '----------------------------------------------- 'Show the delete version on if this is an 'existing version. '----------------------------------------------- If Not V_ID = 0 Then %> <% End If %> |