<% 'This file is part of ProductCart, an ecommerce application developed and sold by Early Impact LLC. ProductCart, its source code, the ProductCart name and logo are property of Early Impact, LLC. Copyright 2001-2003. All rights reserved. You are not allowed to use, alter, distribute and/or resell any parts of ProductCart's source code without the written consent of Early Impact. To contact Early Impact, please visit www.earlyimpact.com. %> <% response.Buffer=true %> <% on error resume next 'Check to see if store has been turned off by admin, then display message If scStoreOff="1" then response.redirect "msg.asp?message=59" End If if session("idcustomer")="" then session("idPCStore")= scID session("idCustomer")=Cint(0) session("idAffiliate")=Cint(1) session("language")=Cstr("english") session("pcCartIndex")=Cint(0) dim pcCartArray(100,35) session("pcCartSession")=pcCartArray end if if session("idPCStore")<>scID then session.Abandon() session("idPCStore")= scID session("idCustomer")=Cint(0) session("idAffiliate")=Cint(1) session("language")=Cstr("english") session("pcCartIndex")=Cint(0) redim pcCartArray(100,35) session("pcCartSession")=pcCartArray end if ' set affiliate if request.querystring("idAffiliate")<>"" and isNumeric(request.querystring("idAffiliate"))then session("idAffiliate")= request.querystring("idAffiliate") end if 'Wholesale-only categories If Session("customerType")=1 Then pcv_strTemp="" else pcv_strTemp=" AND pccats_RetailHide<>1 " end if dim mySQL, conntemp, rstemp, pIdCategory, pCategoryDesc rMode=request.querystring("mode") if rMode="" then scPrdTotal=scSpcNum iPageSize=scPrdTotal 'Product per page iCatPageSize=(scCatRow*scCatRowsPerPage) If Request("page")="" Then iPageCurrent=1 Else iPageCurrent=CInt(Request("page")) End If end if pIdCategory=server.HTMLEncode(request.querystring("idCategory")) mIdCategory=server.HTMLEncode(request.querystring("idCategory")) call openDb() ' get category tree if pIdCategory<>"" then dim arrCategories(999,4) indexCategories=0 pUrlString=Cstr("") pIdCategory2=pidCategory ' load category array with all categories until parent do while pIdCategory2>1 mySQL="SELECT categoryDesc, idCategory, idParentcategory, [image],SDesc,LDesc,HideDesc FROM categories WHERE idCategory=" & pIdCategory2 &" AND iBTOhide=0 " & pcv_strTemp & " ORDER BY priority, categoryDesc ASC" set rsTemp=conntemp.execute(mySQL) if err.number <> 0 then call closeDb() response.redirect "techErr.asp?error="& Server.Urlencode("Error in viewCat_P: "&err.description) end if if rstemp.eof then call closeDb() response.redirect "msg.asp?message=86" end if pIdCategory3=rsTemp("idParentCategory") arrCategories(indexCategories,0)=rsTemp("categoryDesc") arrCategories(indexCategories,1)=rsTemp("idCategory") arrCategories(indexCategories,2)=rsTemp("idParentCategory") arrCategories(indexCategories,3)=rsTemp("image") if pIdCategory2=pidCategory then SDesc=rstemp("SDesc") LDesc=rstemp("LDesc") HideDesc=rstemp("HideDesc") if HideDesc<>"" then else HideDesc="0" end if end if pIdCategory2=pIdCategory3 indexCategories=indexCategories + 1 loop rstemp.close end if 'idParentCategory ' get child categories if pIdCategory="" then mySQL="SELECT * FROM categories WHERE idParentCategory=1 AND idCategory<>1 AND iBTOhide=0 " & pcv_strTemp & " ORDER BY priority, categoryDesc ASC;" else mySQL="SELECT * FROM categories WHERE idParentCategory=" &pIdCategory& " AND idCategory<>1 AND iBTOhide=0 " & pcv_strTemp & " ORDER BY priority, categoryDesc ASC" end if set rstemp=server.createobject("adodb.recordset") rstemp.CacheSize=iCatPageSize rstemp.PageSize=iCatPageSize rsTemp.Open mySQL, Conntemp, adOpenStatic, adLockReadOnly, adCmdText if NOT rsTemp.eof then iPageCount=rstemp.PageCount If Cint(iPageCurrent) > Cint(iPageCount) Then iPageCurrent=iPageCount If iPageCurrent < 1 Then iPageCurrent=1 'rstemp.MoveFirst rstemp.AbsolutePage=iPageCurrent end if if err.number <> 0 then call closeDb() response.redirect "techErr.asp?error="&Server.UrlEncode("Error db viewCat_P. Error: "&err.description) end If ' no categories defined in the store if rstemp.eof and pIdCategory="" then call closeDb() response.redirect "msg.asp?message=85" end if %> <% if rstemp.eof then ' leaf category, list all products mySQL="SELECT idCategory,categoryDesc,[image],idParentCategory FROM categories WHERE idcategory="& pIdCategory &" AND iBTOhide=0 " & pcv_strTemp & " ORDER BY priority, categoryDesc ASC;" set rstemp2=Server.CreateObject("ADODB.Recordset") rsTemp2.Open mySQL, Conntemp, adOpenStatic, adLockReadOnly, adCmdText if err.number <> 0 then call closeDb() response.redirect "techErr.asp?error="&Server.UrlEncode("Error db viewCat_P. Error: "&err.description) end If mySQL="Select POrder from categories_products where idCategory="& pIdCategory set rs4=connTemp.execute(mySQL) UONum=0 do while not rs4.eof if rs4("POrder")<>"" then UONum=UONum+Cint(rs4("POrder")) end if rs4.MoveNext loop ProdSort="" & request("prodsort") if ProdSort<>"" then else if UONum>0 then ProdSort="19" else ProdSort="" & PCOrd end if end if if ProdSort="" then ProdSort="0" end if select case ProdSort Case "19": mySQL1 = " ORDER BY categories_products.POrder Asc" Case "0": mySQL1 = " ORDER BY products.SKU Asc" Case "1": mySQL1 = " ORDER BY products.description Asc" Case "2": If Session("customerType")=1 then mySQL1 = " ORDER BY products.btoBprice desc, products.price Desc" else mySQL1 = " ORDER BY products.price Desc" End if Case "3": If Session("customerType")=1 then mySQL1 = " ORDER BY products.bToBprice Asc, products.price Asc" else mySQL1 = " ORDER BY products.price Asc" end if end select mySQL="SELECT products.idProduct, products.description, products.price, products.serviceSpec, products.ListPrice, products.ListHidden, products.bToBPrice, products.smallImageUrl,products.sDesc,products.pcprod_HideBTOPrice,products.noprices,products.SKU, POrder FROM products, categories_products WHERE products.idProduct=categories_products.idProduct AND categories_products.idCategory="& mIdCategory&" AND active=-1 AND configOnly=0 and removed=0 " & mySQL1 set rstemp2=Server.CreateObject("ADODB.Recordset") rstemp2.CacheSize=iPageSize rstemp2.PageSize=iPageSize rsTemp2.Open mySQL, Conntemp, adOpenStatic, adLockReadOnly, adCmdText if err.number <> 0 then call closeDb() response.redirect "techErr.asp?error="&Server.UrlEncode("Error db viewCat_P. Error: "&err.description) end If dim iPageCount iPageCount=rstemp2.PageCount If Cint(iPageCurrent) > Cint(iPageCount) Then iPageCurrent=iPageCount If iPageCurrent < 1 Then iPageCurrent=1 'rstemp.MoveFirst rstemp2.AbsolutePage=iPageCurrent %> <%if (LDesc<>"") and (HideDesc<>"1") then%> <%end if%> <% if rstemp2.eof then %> <% else%> <%if HideSortPro<>"1" then%> <%end if%>
<% response.write dictLanguage.Item(Session("language")&"_viewCat_P_2") for f=indexCategories-1 to 0 step -1 If arrCategories(f,2)="1" Then response.write "" & arrCategories(f,0) &"" Else response.write " > " & "" & arrCategories(f,0) &"" End If next %>
<%=LDesc%>
<% response.write dictLanguage.Item(Session("language")&"_viewCat_P_4")%>
<%=dictLanguage.Item(Session("language")&"_viewCatOrder_5")%>
<% do while not rstemp2.eof and count < rstemp2.pageSize pidProduct=rstemp2("idProduct") pDescription=rstemp2("description") pPrice=rstemp2("price") pListPrice=rstemp2("listPrice") pListHidden=rstemp2("listHidden") pBtoBPrice=rstemp2("bToBPrice") pSmallImageUrl=rstemp2("smallImageUrl") pserviceSpec=rstemp2("serviceSpec") psDesc=rstemp2("sDesc") pcv_intHideBTOPrice=rstemp2("pcprod_HideBTOPrice") if pcv_intHideBTOPrice<>"" then else pcv_intHideBTOPrice="0" end if pnoprices=rstemp2("noprices") if pnoprices<>"" then else pnoprices=0 end if if pserviceSpec=true then if pnoprices<2 then mySQL="SELECT categories.categoryDesc, products.description, configSpec_products.configProductCategory, configSpec_products.price, configSpec_products.Wprice, categories_products.idCategory, categories_products.idProduct, products.weight FROM categories, products, categories_products INNER JOIN configSpec_products ON categories_products.idCategory=configSpec_products.configProductCategory WHERE (((configSpec_products.specProduct)="&pIdProduct&") AND ((configSpec_products.configProduct)=[categories_products].[idproduct]) AND ((categories_products.idCategory)=[categories].[idcategory]) AND ((categories_products.idProduct)=[products].[idproduct]) AND ((configSpec_products.cdefault)<>0)) ORDER BY configSpec_products.catSort, categories.idCategory, configSpec_products.prdSort;" set rsSSObj=conntemp.execute(mySQL) if err.number <> 0 then response.redirect "techErr.asp?error="& Server.Urlencode("Error in viewPrd: "&err.description) end if if NOT rsSSobj.eof then Dim iAddDefaultPrice, iAddDefaultWPrice iAddDefaultPrice=Cdbl(0) iAddDefaultWPrice=Cdbl(0) do until rsSSobj.eof iAddDefaultPrice=Cdbl(iAddDefaultPrice+rsSSobj("price")) iAddDefaultWPrice=Cdbl(iAddDefaultWPrice+rsSSobj("Wprice")) rsSSobj.moveNext loop set rsSSobj=nothing pPrice=Cdbl(pPrice+iAddDefaultPrice) pBtoBPrice=Cdbl(pBtoBPrice+iAddDefaultWPrice) end if end if end if %> <% if pnoprices=0 then ' check for discount per quantity mySQL="SELECT idDiscountperquantity FROM discountsperquantity WHERE idproduct=" &pidProduct if session("CustomerType")<>"1" then mySQL=mySQL & " and discountPerUnit<>0" else mySQL=mySQL & " and discountPerWUnit<>0" end if Dim rsDisc set rsDisc=Server.CreateObject("ADODB.Recordset") set rsDisc=conntemp.execute(mySQL) if err.number <> 0 then call closedb() response.redirect "techErr.asp?error="& Server.Urlencode("Error in viewPrd: "&err.description) end if Dim pDiscountPerQuantity if not rsDisc.eof then pDiscountPerQuantity=-1 else pDiscountPerQuantity=0 end if set rsDisc = nothing end if %> <% count=count + 1 rstemp2.moveNext loop end if %>
<% else ' is not leaf category %> <% if sccatImages=1 then %> <% else response.write "
" end if %> <%if (SDesc<>"") and (HideDesc<>"1") then%> <%end if%>
<% If pIdCategory<>"" then response.write dictLanguage.Item(Session("language")&"_viewCat_P_2") for f=indexCategories-1 to 0 step -1 If arrCategories(f,2)="1" Then response.write "" & arrCategories(f,0) &"" Else response.write " > " & "" & arrCategories(f,0) &"" End If next else response.write dictLanguage.Item(Session("language")&"_viewCat_P_5") end if %>
<%=SDesc%>
<% i=0 iRecordsShown=0 Do While iRecordsShown < iCatPageSize And NOT rsTemp.EOF pidCategory=rstemp("idCategory") pCategoryDesc=rstemp("categoryDesc") pImage=rstemp("image") CATSDesc=rstemp("SDesc") if pImage="" then pImage="no_image.gif" end if pidParentCategory=rstemp("idParentCategory") Dim pcv_strWidth, pcv_strAlign pcv_strWidth = "" Select case scCatRow case "1": pcv_strWidth = "width=100%" case "2": pcv_strWidth = "width=50%" case "3": pcv_strWidth = "width=33%" case "4": pcv_strWidth = "width=25%" case "5": pcv_strWidth = "width=20%" case "6": pcv_strWidth = "width=16%" case "7": pcv_strWidth = "width=14%" case "8": pcv_strWidth = "width=12%" End Select if sccatImages=0 then pcv_strAlign = "valign=top" else pcv_strAlign = "valign=bottom" end if %> <% i=i + 1 If i > (scCatRow-1) then response.write "" i=0 End If iRecordsShown=iRecordsShown + 1 rsTemp.movenext loop %>
> <% '==================inner table========== %> <% if sccatImages=0 then ' Category images are not shown %> <% else if scCatRow=1 then response.write "
" else response.write "
" end if end if %> <% if sccatImages=1 then if scCatRow=1 then %> <% else %> <% end if else %> <% end if %>
<%=pCategoryDesc%>

<% response.write pCategoryDesc%>
<%if CATSDesc<>"" then%><%=CATSDesc%><%else%> <%end if%>

<%=pCategoryDesc%>
<% response.write pCategoryDesc%> <% response.write pCategoryDesc%>
<% '==================inner table END===========%> <% if sccatImages=1 then %> <% end if %>
<% end If %>
<% If iPageCount>1 then %>
<% If iPageCurrent > 1 Then %> " border="0"> <% End If For I=1 To iPageCount If I=iPageCurrent Then %> <%= I %> <% Else %> <%=I%> <% End If Next If iPageCurrent < iPageCount Then %> " border="0"> <% End If %>
<% end if %>