") end if If V_ID = 0 then P_Desc = Highlight(P_Desc, aryKeywords) end if If P_Desc & "" <> "" then response.Write "
" & P_Desc & "
" & vbcrlf End If %>%@ LANGUAGE="VBSCRIPT" %> <% PageStrings = "18, 33, 55, 104, 105, 108, 150, 151, 152, 156, 157, 158, 159, 160, 161, 265, 266, 294, 295, 296, 648, 779, 1182, 1183, 1184, 1236, 1237, 1311, 1312, 1313, 1336, 1337, 1338, 1339, 1340, 1398, 1442, 1443, 1477, 1617, 1618, 1619, 1620, 1621, 1623, 1659, 1673, 1703, 1704, 1705, 1781, 1782, 1788, 1789, 1791, 1792, 1806, 1807, 1882, 1907, 1908, 1909, 1910, 1911" blnDateStrings = true %> <% '=============================================== ' CactuShop ASP Shopping Cart ' ©1999-2007 Cactusoft International FZ-LLC ' 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. '=============================================== '----------------------------------------------- 'COLLECT VALUES FROM FORM '----------------------------------------------- 'May be from 404 data Set objDynamicLinks = New DynamicLinks Call objDynamicLinks.Build(request.QueryString, objRecordSet) If objDynamicLinks.PageType = "product" then V_ID = 0 P_ID = objDynamicLinks.ProdID CAT_ID = objDynamicLinks.CatID strSelectedOptions = "" else V_ID = NumSafe(request.Querystring("V_ID")) P_ID = NumSafe(request.Querystring("P_ID")) CAT_ID = NumSafe(request.Querystring("CAT_ID")) strSelectedOptions = Request.QueryString("strOptions") end if 'Useful application variables strAppUploadsFolder = GetAppVar("uploadsfolder") '----------------------------------------------- 'SECURITY CHECKS '----------------------------------------------- 'If this gets set, don't show the product. This is 'security for language-specific products blnNoShow = false 'If using access, append products table name for casting if strDatabaseType = "access" then strTblProd = "tblCactuShop" & TABLE_PREFIX & "Products." else strTblProd = "" '----------------------------------------------- 'FORMAT QUERY AND RUN IT '----------------------------------------------- strQuery2 = "SELECT CAT_Live, CAT_Name" & CInt(numLanguageID) & ", P_StrapLine" & CInt(numLanguageID) & ", P_Live, P_Name" & CInt(numLanguageID) & ", P_SpecTable" & CInt(numLanguageID) & ", " & strTblProd & castSQL("P_Desc" & CInt(numLanguageID)) & " as P_Desc" & CInt(numLanguageID) & ", P_HyperLink" & CInt(numLanguageID) & ", P_OrderVersionsBy, P_VersionDisplayType, P_Reviews FROM ((((tblCactuShop" & TABLE_PREFIX & "Versions INNER JOIN tblCactuShop" & TABLE_PREFIX & "TaxRates ON tblCactuShop" & TABLE_PREFIX & "Versions.V_Tax = tblCactuShop" & TABLE_PREFIX & "TaxRates.T_ID) INNER JOIN tblCactuShop" & TABLE_PREFIX & "Products ON tblCactuShop" & TABLE_PREFIX & "Versions.V_ProductID = tblCactuShop" & TABLE_PREFIX & "Products.P_ID) INNER JOIN tblCactuShop" & TABLE_PREFIX & "ProductCategoryLink ON tblCactuShop" & TABLE_PREFIX & "Products.P_ID = tblCactuShop" & TABLE_PREFIX & "ProductCategoryLink.PCAT_ProductID) INNER JOIN tblCactuShop" & TABLE_PREFIX & "Categories ON tblCactuShop" & TABLE_PREFIX & "ProductCategoryLink.PCAT_CategoryID = tblCactuShop" & TABLE_PREFIX & "Categories.CAT_ID) LEFT OUTER JOIN tblCactuShop" & TABLE_PREFIX & "Suppliers ON tblCactuShop" & TABLE_PREFIX & "Products.P_SupplierID = tblCactuShop" & TABLE_PREFIX & "Suppliers.SUP_ID WHERE P_ID=" & P_ID & " AND V_Live='y' AND P_Live='y' AND V_CustomerGroupID IN (0," & NumSafe(DB_CG_ID) & ") AND P_CustomerGroupID IN (0," & NumSafe(DB_CG_ID) & ") AND CAT_Live='y' AND CAT_CustomerGroupID IN (0," & NumSafe(DB_CG_ID) & ") AND (SUP_Live <> 'n' OR SUP_Live IS NULL)" Call ExecuteRS(strQuery2, objRecordSet) If not (objRecordSet.BOF And objRecordSet.EOF) then P_OrderVersionsBy = objRecordSet("P_OrderVersionsBy") P_VersionDisplayType = objRecordSet("P_VersionDisplayType") P_Reviews = objRecordSet("P_Reviews") P_Name = objRecordSet("P_Name" & numLanguageID) CAT_Name = objRecordSet("CAT_Name" & numLanguageID) blnNoShow = (P_Name & "" = "") 'Set the string to use as the title of this page - good for search engines! 'Note that description now may be altered below in the custom product attributes strPageTitleHTML = P_Name & GetString("PageTitle_Separator") & GetString("Config_Webshopname") strMetaDescHTML = left(objRecordSet("P_Desc" & CInt(numLanguageID)), 300) 'Save this to recently viewed products If GetAppVar("recentproducts") > 0 then Call SaveToRecentProducts(P_ID) End If else blnNoShow = true end if '----------------------------------------------- 'PRODUCT TRACKING '----------------------------------------------- if GetAppVar("tracking") = "y" and blnLoggedInToBackend = false then strQuery = "INSERT INTO tblCactuShop" & TABLE_PREFIX & "ProductStats (PS_ProductID, PS_Date, PS_IP) VALUES (" & _ P_ID &_ "," & strDateDelimiter & ReverseDate(NowOffset()) & strDateDelimiter &_ ",'" & SQLSafe(Request.ServerVariables("HTTP_HOST")) & "')" Call ExecuteNonQuery(strQuery) End if If not (objRecordSet.BOF And objRecordSet.EOF) and not blnNoShow then '----------------------------------------------- 'GET LOCATION BAR 'We've moved this up so that we can check that 'all categories below us are 'legal' for 'this language. If not, we should show 'the unavailable sign '----------------------------------------------- Set objTrail = New BreadCrumbTrail If objDynamicLinks.PageType = "product" then objTrail.Parents = objDynamicLinks.CatParents objTrail.PageHistory = objDynamicLinks.PageHistory End If 'Get keyword search array if we've come from the search If objTrail.PageHistory = "search" then aryKeywords = CreateKeywordArray(objCactuSession.Value("search_keywords"), objCactuSession.Value("search_searchcriteria")) End If 'Get out the category name If CAT_ID = 0 then CAT_Name = "" Else strQuery = "SELECT CAT_Name" & numLanguageID & " FROM tblCactuShop" & TABLE_PREFIX & "Categories WHERE CAT_ID=" & NumSafe(CAT_ID) & " AND CAT_Live = 'y'" Call ExecuteRS(strQuery, objRecordSet2) If not (objRecordSet2.BOF and objRecordSet2.EOF) then CAT_Name = objRecordSet2(0) End If objRecordSet2.Close End If 'Build the trail Call objTrail.Build(objRecordSet2, CAT_ID, CAT_Name, P_Name) 'Build the attributes If SOFTWARE_IS_PRO then Set objAttributes = New ProductAttributes Call objAttributes.Build(P_ID) 'Set the meta data if required If objAttributes.MetaDescriptionHTML <> "" then strMetaDescHTML = objAttributes.MetaDescriptionHTML If objAttributes.MetaKeywordsHTML <> "" then strMetaKeywordsHTML = objAttributes.MetaKeywordsHTML If objAttributes.MetaPageTitleHTML <> "" then strPageTitleHTML = objAttributes.MetaPageTitleHTML End If end if '// got a product? '----------------------------------------------- 'Buildpage comes down here because settings like 'meta tags are dependant on the code above '----------------------------------------------- %><% '----------------------------------------------- 'READ PAGE TEMPLATE FROM FILE '----------------------------------------------- Call ReadFromTemplate(strTemplateLocation, aryPageTemplate) '----------------------------------------------- 'WRITE FIRST HALF OF PAGE HTML '----------------------------------------------- response.write(aryPageTemplate(0)) If blnNoShow then 'Product doesn't exist - show message %>
<% WriteString("ContentText_ProductUnavailable") %>
<% else %>" & P_Desc & "
" & vbcrlf End If %><%= P_SpecTable %><% end if '-------------------------------------------------- ' VERSION DISPLAY '-------------------------------------------------- objRecordSet.close numBgCount = 0 '----------------------------------------------- 'GENERATE TABLE OF VERSIONS OR OPTION GROUPS '----------------------------------------------- strVersionsOrderBy = GetAppVar("sortversions") If P_OrderVersionsBy <> "" then strVersionsOrderBy = P_OrderVersionsBy If strVersionsOrderBy = "" then strVersionsOrderBy = "V_Name" if strVersionsOrderBy = "V_Name" or strVersionsOrderBy = "V_Desc" then strVersionsOrderBy = strVersionsOrderBy & CInt(numLanguageID) If P_VersionDisplayType = "g" or P_VersionDisplayType = "l" then 'Doing an option group. We don't need to pull out the versions - just the option groups strQuery = "SELECT OPTG_ID, OPTG_Name" & CInt(numLanguageID) & ", OPTG_Desc" & CInt(numLanguageID) & ", OPTG_OptionDisplayType FROM tblCactuShop" & TABLE_PREFIX & "OptionGroups INNER JOIN tblCactuShop" & TABLE_PREFIX & "ProductOptionGroupLink ON tblCactuShop" & TABLE_PREFIX & "OptionGroups.OPTG_ID = tblCactuShop" & TABLE_PREFIX & "ProductOptionGroupLink.P_OPTG_OptionGroupID WHERE tblCactuShop" & TABLE_PREFIX & "ProductOptionGroupLink.P_OPTG_ProductID = " & P_ID & " ORDER BY P_OPTG_OrderByValue" Else 'If using access, append versions table name for casting if strDatabaseType = "access" then strTblVer = "v." else strTblVer = "" strQuery = "SELECT DISTINCT T_Taxrate, V_ID, V_Price, V_Weight, V_RRP, V_Tax, V_ProductID, V_CodeNumber, V_Quantity, V_Quantity, V_QuantityWarnLevel, " & strVersionsOrderBy & " As OrderByBit, V_Name" & numLanguageID & ", " & strTblVer & castSQL("V_Desc" & numLanguageID) & " as V_Desc" & numLanguageID & ", MIN(QD_ID) As QuantityDiscount FROM (tblCactuShop" & TABLE_PREFIX & "Versions v INNER JOIN tblCactuShop" & TABLE_PREFIX & "TaxRates tr ON v.V_Tax = tr.T_ID) LEFT JOIN tblCactuShop" & TABLE_PREFIX & "QuantityDiscounts qd ON v.V_ID = qd.QD_VersionID WHERE V_Live = 'y' AND V_CustomerGroupID IN (0," & numSafe(DB_CG_ID) & ") AND V_ProductID=" & P_ID & " AND V_Name" & numLanguageID & " <> '' GROUP BY T_Taxrate, V_ID, V_Price, V_Weight, V_RRP, V_Tax, V_ProductID, V_CodeNumber, V_Quantity, V_QuantityWarnLevel, " & strVersionsOrderBy & ", V_Name" & numLanguageID & ", " & castSQL("V_Desc" & numLanguageID) & " ORDER BY " & strVersionsOrderBy End If Call ExecuteRS(strQuery, objRecordSet) blnGotMoreThanOneVersion = (objRecordSet.RecordCount > 1) '----------------------------------------- 'CUSTOMER GROUP PRICING '----------------------------------------- If DB_CG_ID > 0 then strQuery = GetCustomerGroupPricesQuery(P_ID, strVersionsOrderBy) Call ExecuteRS(strQuery, objRecordSet2) End If 'Show the versions Set objRecordSetOptions = Server.CreateObject("ADODB.RecordSet") Call ShowVersions(objRecordSet, objRecordSet2, objRecordSetOptions, P_ID, P_VersionDisplayType, "product", objFileSystem, aryKeywords, 1, objTrail, strSelectedOptions) Set objRecordSetOptions = Nothing If DB_CG_ID > 0 then objRecordSet2.Close objRecordSet.Close %> <% '----------------------------------------- 'PRODUCT PROMOTIONS 'Display the related product promos '----------------------------------------- If SOFTWARE_IS_PRO then Call DisplayPromotionsForProduct(P_ID) End if '----------------------------------------- 'PRODUCT REVIEWS 'Display the product reviews, and a link 'to add a review. '----------------------------------------- If GetAppVar("enablereviews") = "y" and P_Reviews <> "n" then strAppReviewPermission = GetAppVar("reviewpermission") If strAppReviewPermission = "customersonly" then blnGotReviewPermission = (DB_C_ID > 0) ElseIf strAppReviewPermission = "purchasersonly" then strQuery = "SELECT null FROM (tblCactuShop" & TABLE_PREFIX & "Versions INNER JOIN tblCactuShop" & TABLE_PREFIX & "InvoiceRows ON tblCactuShop" & TABLE_PREFIX & "Versions.V_CodeNumber = tblCactuShop" & TABLE_PREFIX & "InvoiceRows.IR_VersionCode) INNER JOIN tblCactuShop" & TABLE_PREFIX & "Orders ON tblCactuShop" & TABLE_PREFIX & "InvoiceRows.IR_OrderNumberID = tblCactuShop" & TABLE_PREFIX & "Orders.O_ID WHERE O_CustomerID = " & DB_C_ID & " AND O_Sent = 'y' AND O_Shipped = 'y' AND V_ProductID=" & P_ID Call ExecuteRS(strQuery, objRecordSet) blnGotReviewPermission = Not (objREcordSet.BOF and objREcordSet.EOF) objRecordSet.Close Else blnGotReviewPermission = true end if 'Start the review table %>
" & vbcrlf response.Write "" & REV_Text & "
<% WriteString("ContentText_NoReviews") %>
<% End If objRecordSet.Close 'Add a link to add a new review. Different lang string depending on 'whether there are any existing reviews. If blnGotReviewPermission then %> <% end if %>