%@ LANGUAGE="VBSCRIPT" %>
<% PageStrings = "18, 31, 55, 57, 107, 108, 149, 150, 151, 152, 153, 154, 158, 160, 161, 265, 266, 648, 897, 898, 1231, 1236, 1237, 1442, 1443, 1458, 1490, 1659, 1673, 1688, 1689, 1703, 1704, 1782, 1791, 1792, 1806, 1807" %>
<%
'===============================================
' 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
'See if we call pull out the ID at the end
'Defensive coding as the querystring could
'contain pretty much anything, and we need to
'handle it.
'-----------------------------------------------
'-----------------------------------------------
'COLLECT VALUES
'-----------------------------------------------
'Get category ID - may be from 404 data, or from querystring
Set objDynamicLinks = New DynamicLinks
Call objDynamicLinks.Build(request.QueryString, objRecordSet)
If objDynamicLinks.PageType = "category" then
CAT_ID = objDynamicLinks.CatID
numRecordPosition = objDynamicLinks.CatRecordPosition
Else
CAT_ID = NumSafe(DualRequest("CAT_ID"))
numRecordPosition = NumSafe(request.querystring("numRecordPosition"))
End If
'If we haven't got a page, set it to 1
If numRecordPosition = 0 then numRecordPosition = 1
'-----------------------------------------------
'PULL OUT PRODTYPE FROM DATABASE
'-----------------------------------------------
blnNoShow = false
strQuery = "SELECT CAT_Name" & CInt(numLanguageID) & ", CAT_ProductDisplayType, CAT_SubCatDisplayType, CAT_Desc" & CInt(numLanguageID) & ", CAT_OrderProductsBy FROM tblCactuShop" & TABLE_PREFIX & "Categories WHERE CAT_Live='y' AND CAT_CustomerGroupID IN (0," & NumSafe(DB_CG_ID) & ") AND CAT_ID=" & CAT_ID
Call ExecuteRS(strQuery, objRecordSet)
If not (objRecordSet.BOF and objRecordSet.EOF) then
CAT_Name = objRecordSet("CAT_Name" & CInt(numLanguageID) & "")
CAT_ProductDisplayType = objRecordSet("CAT_ProductDisplayType")
CAT_SubCatDisplayType = objRecordSet("CAT_SubCatDisplayType")
CAT_Desc = objRecordSet("CAT_Desc" & CInt(numLanguageID))
CAT_OrderProductsBy = objRecordSet("CAT_OrderProductsBy")
blnNoShow = objRecordSet("CAT_Name" & CInt(numLanguageID)) & "" = ""
'Set the string to use as the title of this page - good for search engines!
strPageTitleHTML = CAT_Name & GetString("PageTitle_Separator") & GetString("Config_Webshopname")
strMetaDescHTML = left(CAT_Desc, 300)
Else
CAT_ProductDisplayType = "d"
CAT_SubCatDisplayType = "d"
CAT_ID = "0"
'Set the string to use as the title of this page - good for search engines!
strPageTitleHTML = GetString("ContentText_Categories") & GetString("PageTitle_Separator") & GetString("Config_Webshopname")
strMetaDescHTML = ""
End if
If GetAppVar("convertdescbreaks") = "y" then
CAT_Desc = replace(CAT_Desc & "", vbcrlf, "
")
end if
objRecordSet.close
'-----------------------------------------------
'BUILDPAGE (done lower for meta tags)
'-----------------------------------------------
%>
<%
'***********************************************
'GET OUT ALL THE PRODUCTS
'We do this now because the page links comes
'quite early on.
'***********************************************
'-----------------------------------------------
'SET ORDERING CLAUSE
'Get the ordering from prodtype or config
'-----------------------------------------------
strProductsOrderBy = GetAppVar("sortproducts")
If CAT_OrderProductsBy <> "" then strProductsOrderBy = CAT_OrderProductsBy
if strProductsOrderBy = "" then strProductsOrderBy = "P_Name"
'If the orderby is a 'languaged'-field, then stick on the numerical language ID
If strProductsOrderBy = "P_Name" or strProductsOrderBy = "P_Desc" or strProductsOrderBy = "P_StrapLine" or strProductsOrderBy = "P_SpecTable" or strProductsOrderBy = "P_Hyperlink" then
strProductsOrderBy = strProductsOrderBy & CInt(numLanguageID)
end if
'-----------------------------------------------
'PULL OUT PRODUCTS FROM DATABASE
'First list the selects. If the orderby isn't
'in the selects, then add it on to the end. The
'add on the rest of the query (otherwise you
'get a 'conflicts with DISTINCT error')
'DISTINCTROW stops descriptions getting truncated
'at 255 characters.
'
'If strAppShowPriceOnProductDisplay turned on,
'then we select a MIN(V_Price), and need to group
'by all the other selects. Don't do this if it's
'turn off as it slows down the query.
'-----------------------------------------------
strAppShowPriceOnProductDisplay = GetAppVar("showpriceonproductdisplay")
'If using access, append products table name for casting
if strDatabaseType = "access" then strTblProd = "tblCactuShop" & TABLE_PREFIX & "Products." else strTblProd = ""
strSelectValues = "CAT_ID, P_ID, P_VersionDisplayType, P_OrderVersionsBy, P_StrapLine" & CInt(numLanguageID) & ", " & strTblProd & castSQL("P_Desc" & CInt(numLanguageID)) & " as P_Desc" & CInt(numLanguageID) & ", P_Name" & CInt(numLanguageID) & ", P_Type"
StrSelectValues2 = Replace(strSelectValues, "as P_Desc" & CInt(numLanguageID),"")
if instr(strSelectValues, strProductsOrderBy) = 0 then
strSelectValues = strSelectValues & ", " & strProductsOrderBy
strSelectValues2 = strSelectValues2 & ", " & strProductsOrderBy
end if
If strAppShowPriceOnProductDisplay = "y" then
strQuery = "SELECT " & strDistinctRowStatement & " " & strSelectValues & ", MIN(V_Price) As MinPrice, MIN(T_TaxRate) As MinTaxRate FROM ((((tblCactuShop" & TABLE_PREFIX & "Categories c INNER JOIN tblCactuShop" & TABLE_PREFIX & "ProductCategoryLink pcl ON c.CAT_ID = pcl.PCAT_CategoryID) INNER JOIN tblCactuShop" & TABLE_PREFIX & "Products ON pcl.PCAT_ProductID = tblCactuShop" & TABLE_PREFIX & "Products.P_ID) INNER JOIN tblCactuShop" & TABLE_PREFIX & "Versions v ON tblCactuShop" & TABLE_PREFIX & "Products.P_ID = v.V_ProductID) INNER JOIN tblCactuShop" & TABLE_PREFIX & "TaxRates t on v.V_Tax = t.T_ID) LEFT OUTER JOIN tblCactuShop" & TABLE_PREFIX & "Suppliers s ON tblCactuShop" & TABLE_PREFIX & "Products.P_SupplierID = s.SUP_ID WHERE P_Name" & CInt(numLanguageID) & " <> '' AND V_Live = 'y' AND V_CustomerGroupID IN (0," & NumSafe(DB_CG_ID) & ") AND P_Live = 'y' AND P_CustomerGroupID IN (0," & NumSafe(DB_CG_ID) & ") AND CAT_Live = 'y' AND CAT_CustomerGroupID IN (0," & NumSafe(DB_CG_ID) & ") AND CAT_ID=" & CAT_ID & " AND (SUP_Live <> 'n' OR SUP_Live IS NULL) GROUP BY " & strSelectValues2 & " ORDER BY " & strProductsOrderBy
Else
strQuery = "SELECT " & strDistinctRowStatement & " " & strSelectValues & " FROM (((tblCactuShop" & TABLE_PREFIX & "Categories INNER JOIN tblCactuShop" & TABLE_PREFIX & "ProductCategoryLink ON tblCactuShop" & TABLE_PREFIX & "Categories.CAT_ID = tblCactuShop" & TABLE_PREFIX & "ProductCategoryLink.PCAT_CategoryID) INNER JOIN tblCactuShop" & TABLE_PREFIX & "Products ON tblCactuShop" & TABLE_PREFIX & "Products.P_ID = tblCactuShop" & TABLE_PREFIX & "ProductCategoryLink.PCAT_ProductID) INNER JOIN tblCactuShop" & TABLE_PREFIX & "Versions ON tblCactuShop" & TABLE_PREFIX & "Versions.V_ProductID = tblCactuShop" & TABLE_PREFIX & "Products.P_ID) LEFT OUTER JOIN tblCactuShop" & TABLE_PREFIX & "Suppliers ON tblCactuShop" & TABLE_PREFIX & "Products.P_SupplierID = tblCactuShop" & TABLE_PREFIX & "Suppliers.SUP_ID WHERE P_Name" & CInt(numLanguageID) & " <> '' 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 CAT_ID=" & CAT_ID & " AND (SUP_Live <> 'n' OR SUP_Live IS NULL) ORDER BY " & strProductsOrderBy
End If
Call ExecuteRS(strQuery, objRecordSet)
'Move to correct record for the start of the page
numRecordCount = objRecordSet.RecordCount
If numRecordCount > 0 then
objRecordSet.AbsolutePosition = numRecordPosition
end if
'-----------------------------------------------
'SET VALUES FOR ITEMS PER PAGE
'Note that rows and columns are determined from
'the CSS, not in config settings (as was the
'case in prior CactuShop versions). Instead, you
'specify how many items per page are shown in
'shortformat, and then size the width of these
'items in CSS. The browser fits as many as it
'can per line.
'-----------------------------------------------
'These need to be set here so the top paging works
'Display type - defaults should be set to the application setting
If CAT_ProductDisplayType = "d" then CAT_ProductDisplayType = GetAppVar("defaultproddisplay")
If CAT_SubCatDisplayType = "d" then CAT_SubCatDisplayType = GetAppVar("defaultprodtypedisplay")
If CAT_ProductDisplayType = "s" then
numProdsPerPage = GetAppVar("shortformatpagesize")
else
numProdsPerPage = GetAppVar("prodtypepagesize")
end if
'-----------------------------------------------
'READ PAGE TEMPLATE FROM FILE
'-----------------------------------------------
Call ReadFromTemplate(strTemplateLocation, aryPageTemplate)
'-----------------------------------------------
'WRITE FIRST HALF OF PAGE HTML
'-----------------------------------------------
response.write(aryPageTemplate(0))
'Set image stuff - must come after readfromtemplate
Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
aryFileTypes = Split(GetAppVar("allowedimages"), ",")
strAppUploadsFolder = GetAppVar("uploadsfolder")
strCategoryPath = Server.MapPath(strTemplateShopFolder & strAppUploadsFolder & "images_categories/")
strCategoryLargePath = Server.MapPath(strTemplateShopFolder & strAppUploadsFolder & "images_categories_large/")
strVersionPath = Server.MapPath(strTemplateShopFolder & strAppUploadsFolder & "images_versions/")
strVersionLargePath = Server.MapPath(strTemplateShopFolder & strAppUploadsFolder & "images_versions_large/")
strProductPath = Server.MapPath(strTemplateShopFolder & strAppUploadsFolder & "images_products/")
If blnNoShow then
'Category not found - display message %>
<% WriteString("ContentText_ProdTypeUnavailable") %>
<% else '*********************************************** 'DISPLAY HEADER 'Location bar, pagination, trail, category details '*********************************************** Set objTrail = New BreadCrumbTrail 'Set overrides if needed If objDynamicLinks.PageType = "category" then objTrail.Parents = objDynamicLinks.CatParents objTrail.PageHistory = objDynamicLinks.PageHistory End If 'Get keyword search array if we're from the search If objTrail.PageHistory = "search" then aryKeywords = CreateKeywordArray(objCactuSession.Value("search_keywords"), objCactuSession.Value("search_searchcriteria")) End If If CAT_ID = 0 then 'Set the page history to category objTrail.PageHistory = "category" 'Just show the title %>" & CAT_Desc & "
" & strLargeHTML If strText <> "" then response.write "