<%@ LANGUAGE="VBSCRIPT" %> <% PageStrings = "326, 327, 361, 400, 421, 517, 518, 524, 525, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 549, 865, 866, 868, 1149, 1150, 1151, 1152, 1153, 1246" 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 PRODUCT 'This page brings up products for editing, or 'produces a blank product form for adding new 'products. '----------------------------------------------- '----------------------------------------------- 'FUNCTION: BUILD UP PRODTYPE MULTISELECTOR '----------------------------------------------- Function DoCats(objCategoriesDictionary, objSubCategoriesDictionary, numMotherID, strTrail) 'Write out the trail response.write("") 'If there are any sub categories for this category If objSubCategoriesDictionary.Exists(CInt(numMotherID)) then 'Get all sub categories and loop through them arySubCategories = split(objSubCategoriesDictionary.Item(CInt(numMotherID)), ",") For each intSubCategory in arySubCategories If isnumeric(intSubCategory) then 'Add the sub category to the end of the trail and call the function with the new sub-cat strTrailToPass = "    " & strTrail DoCats objCategoriesDictionary, objSubCategoriesDictionary, intSubCategory, strTrailToPass end if Next end if end Function '----------------------------------------------- 'COLLECT VALUES FROM QUERYSTRING '----------------------------------------------- P_ID = Request.Querystring("P_ID") PT_ID = Request.Querystring("PT_ID") numOriginalProdType = PT_ID Dim P_Name(), P_Desc(), P_StrapLine(), P_SpecTable(), P_Hyperlink() Redim P_Name(numTotalLanguages) Redim P_Desc(numTotalLanguages) Redim P_StrapLine(numTotalLanguages) Redim P_SpecTable(numTotalLanguages) Redim P_Hyperlink(numTotalLanguages) '----------------------------------------------- 'RUN DATABASE QUERY '----------------------------------------------- strQuery = "SELECT * FROM tblCactuShopProducts WHERE P_ID = " & P_ID Call ExecuteSQL(strQuery, numCursorType, objRecordSet) numRecordCount = objRecordSet.RecordCount '----------------------------------------------- 'If a product has been pulled out of the DB then 'set these variables to the field info that was 'pulled out, otherwise this is a new product and 'the variables will be left blank. '----------------------------------------------- If numRecordCount > 0 Then P_ID = objRecordSet("P_ID") P_Live = objRecordSet("P_Live") P_Featured = objRecordSet("P_Featured") P_OrderByValue = objRecordSet("P_OrderByValue") P_OrderVersionsBy = objRecordSet("P_OrderVersionsBy") P_VersionDisplayType = objRecordSet("P_VersionDisplayType") strFirstNonEmptyName = objRecordSet("P_Name" & numLanguageID) & "" 'Loop through all languages and get the names and descriptions For numCounter = 1 to numTotalLanguages If aryLangLiveBack(numCounter) = "y" then P_Name(numCounter) = SafeHTMLencode(objRecordSet("P_Name" & CStr(numCounter))) P_Desc(numCounter) = SafeHTMLencode(objRecordSet("P_Desc" & CStr(numCounter))) P_StrapLine(numCounter) = SafeHTMLencode(objRecordSet("P_StrapLine" & CStr(numCounter))) P_SpecTable(numCounter) = SafeHTMLencode(objRecordSet("P_SpecTable" & CStr(numCounter))) P_Hyperlink(numCounter) = SafeHTMLencode(objRecordSet("P_Hyperlink" & CStr(numCounter))) If P_Name(numCounter) <> "" and strFirstNonEmptyName = "" then strFirstNonEmptyName = P_Name(numCounter) end if end if Next Else P_ID = 0 End If objRecordSet.Close '----------------------------------------------- 'SET CATEGORY WE CLICK-THROUGH FROM AS ON '----------------------------------------------- dim strSelectedCategories If P_ID = 0 Then strSelectedCategories = "z" & PT_ID & "z" %> <% =GetString("Config_headtitle") %>
"> <% 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 %>
<% If numRecordCount = 0 Then WriteString("PageTitle_NewProduct") Else Response.Write(strFirstNonEmptyName) %>
<% WriteString("FormLabel_ShowOnSite") %> checked="true" <% End If%>name="P_Live" type="checkbox" value="y">
<% WriteString("FormLabel_Categories") %> <% '----------------------------------------------- 'Build up a string of ID numbers of categories 'that are selected to use for highlighting the 'selections in the full categories dropdown 'later '----------------------------------------------- strQuery = "SELECT PPT_ProdtypeID FROM tblCactuShopProductProdTypeLink WHERE PPT_ProductID = " & P_ID Call ExecuteSQL(strQuery, numCursorType, objRecordSet) Do Until objRecordSet.EOF strSelectedCategories = strSelectedCategories & "z" & objRecordSet(0) & "z" If numOriginalProdType = "" then numOriginalProdType = objRecordSet(0) objRecordSet.MoveNext Loop objRecordSet.Close '----------------------------------------------- 'Pull out all categories and highlight them if 'the ID number is featured in the string that 'we created above. '----------------------------------------------- strQuery = "SELECT " For numCounter = 1 to numTotalLanguages: strQuery = strQuery & "tblCactuShopProdtype.PT_Name" & CStr(numCounter) & ", MasterProducts.PT_Name" & CStr(numCounter) & " As MotherName" & CStr(numCounter) & ", ": Next strQuery = strQuery & "tblCactuShopProdtype.PT_ID, tblCactuShopProdtype.PT_MotherProdType FROM tblCactuShopProdtype LEFT OUTER JOIN tblCactuShopProdtype AS MasterProducts ON tblCactuShopProdtype.PT_MotherProdType = MasterProducts.PT_ID ORDER BY tblCactuShopProdtype." & strCategoryOrderBy Call ExecuteSQL(strQuery, numCursorType, objRecordSet) %>
<% WriteString("FormLabel_Featured") %> <% WriteString("ContentText_FeaturedText") %>
<% WriteString("FormLabel_VersionDisplayType") %>

<%= aryLangBackNames(numCounter) %>
<% WriteString("FormLabel_Title") %>
<% WriteString("FormLabel_StrapLine") %>
<% WriteString("FormLabel_Description") %>
<% WriteString("FormLabel_Specifications") %>
<% WriteString("FormLabel_Hyperlink") %>

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

<% WriteString("ContentText_LargeImage") %>
<% '----------------------------------------- 'FIND AND SHOW EXISTING IMAGE (IF ANY) '----------------------------------------- If Not CallMode = "new" Then strFile = GetFileLocation(Server.MapPath(Application(LICENSENUMBER & "uploadsfolder") & "images_products_large/"), P_ID, Split(Application(LICENSENUMBER & "allowedimages"), ","), objFileSystem) If strFile = "" Then strFileStatus = GetString("ContentText_NoImagePresent") Else strFileStatus = "
" End If End If '----------------------------------------- 'HANDLE LOGO DISPLAY AND UPLOADER BOX '----------------------------------------- Response.Write(strFileStatus) %>
<% If Not P_ID = 0 And Not strFile = "" Then %> <% WriteString("ContentText_TickHereToRemoveImage") %> <% End If %>
  ">
<% 'Need to put this here since it can't be set until the multidropdown %>

<% '----------------------------------------------- 'If a product is being edited then we need to 'show the delete option and the table of 'versions. '----------------------------------------------- If numRecordCount > 0 Then %>
"> <% WriteString("ContentText_DeleteThisProduct") %>

<% '----------------------------------------------- 'GENERATE VERSIONS TABLE '----------------------------------------------- strVersionsOrderBy = Application(LICENSENUMBER & "orderby_versions") If P_OrderVersionsBy <> "" then strVersionsOrderBy = P_OrderVersionsBy If strVersionsOrderBy = "" then strVersionsOrderBy = "V_Name" if strVersionsOrderBy = "V_Name" or strVersionsOrderBy = "V_Desc" then strVersionsOrderBy = strVersionsOrderBy & CStr(numLanguageID) strQuery = "SELECT * FROM (tblCactuShopTaxRates INNER JOIN tblCactuShopVersions ON tblCactuShopTaxRates.T_ID = tblCactuShopVersions.V_Tax) INNER JOIN tblCactuShopProducts ON tblCactuShopVersions.V_Product = tblCactuShopProducts.P_ID WHERE P_ID=" & P_ID & " ORDER BY " & strVersionsOrderBy Call ExecuteSQL(strQuery, numCursorType, objRecordSet) strPath = Server.MapPath(Application(LICENSENUMBER & "uploadsfolder") & "images_versions") Do Until objRecordSet.EOF numBackgroundCounter = numBackgroundCounter + 1 numPrice = Round(objRecordSet("V_Price"), 2) numTax = objRecordSet("T_Taxrate") If numBackgroundCounter mod 2 = 0 then strBGColour = "#EEEEEE" strBGColour2 = "#FFAAAA" Else strBGColour = "#DDDDDD" strBGColour2 = "#FFBBBB" End If If objRecordSet("V_Quantity") <= 0 Then strBGColour = strBGColour2 If objRecordSet("V_Live") = "y" Then strTempClass = "smallbold" Else strTempClass = "smallnormal" 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 strVersionDesc = objRecordSet("V_Desc" & CStr(numLanguageID)) If strVersionDesc & "" = "" then numCounter = 0 for numCounter = 1 to numTotalLanguages strVersionDesc = objRecordSet("V_Desc" & CStr(numCounter)) If strVersionDesc & "" <> "" then exit for next end if %> <% '----------------------------------------- 'FIND AND SHOW EXISTING IMAGE (IF ANY) '----------------------------------------- strFile = GetFileLocation(strPath, objRecordSet("V_ID"), Split(Application(LICENSENUMBER & "allowedimages"), ","), objFileSystem) If strFile = "" Then strFileStatus = "" Else strFileStatus = "
" End If If Not strVersionDesc & "" = "" Then strFileStatus = strFileStatus & strVersionDesc If strFileStatus <> "" then %> <% end if objRecordSet.moveNext Loop objRecordSet.Close Set objFileSystem = Nothing %>
<% WriteString("ContentText_CurrentVersionsOfProduct") %>
  <% WriteString("ContentText_CodeNo") %> <% WriteString("ContentText_Qty") %> <% WriteString("ContentText_Price") %> <% WriteString("ContentText_Tax") %>  
<% =strVersionName %> <% =objRecordSet("V_CodeNumber") %> <% =objRecordSet("V_Quantity") %> (<% Response.Write(objRecordSet("V_QuantityWarnLevel")) %>) <% =strDefaultCurrencySymbol & " " & CurrencyDisplay(numPrice, 1, blnDefaultCurrencyHasDecimals) %> <% =numTax %> &P_ID=<% =P_ID %>&strCallMode=c"><% WriteSafeString(" title="<% WriteSafeString("ImageLabel_CloneThisVersion") %>" src="images_webshop/c_version.gif" border="0"> &P_ID=<% =P_ID %>"><% WriteSafeString(" title="<% WriteSafeString("ImageLabel_EditThisVersion") %>" src="images_webshop/b_version.gif" border="0">
<% '----------------------------------------- 'HANDLE LOGO DISPLAY AND UPLOADER BOX '----------------------------------------- Response.Write(strFileStatus) %>
<% End If %>
<% WriteString("ContentText_ProductPagetext") %>
<% objDataConn.Close Set objDataConn = Nothing %>