<% 'This file is part of e-Merchant Pro 1.0, an ecommerce application developed and sold by GWS(Global Web Solutions) LLC. e-Merchant Pro 1.0, its source code, the e-Merchant Pro 1.0 name and logo are property of GWS(Global Web Solutions), LLC. Copyright 2001-2003. All rights reserved. You are not allowed to use, alter, distribute and/or resell any parts of e-Merchant Pro 1.0's source code without the written consent of GWS(Global Web Solutions). To contact GWS(Global Web Solutions), please visit www.globalwsolutions.com. %> <% response.Buffer=true %> <%Dim iAddDefaultPrice, iAddDefaultWPrice%> <% on error resume next Dim query, conntemp, rsProducts, rsDisc, pDiscountPerQuantity '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' START: Check store on/off, start PC session, check affiliate ID '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %> <% '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' END: Check store on/off, start PC session, check affiliate ID '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '******************************* ' LOAD SETTINGS (same as home page) '******************************* call opendb() query="SELECT pcHPS_Style,pcHPS_ShowSKU,pcHPS_ShowImg FROM pcHomePageSettings;" set rs=server.CreateObject("ADODB.RecordSet") set rs=connTemp.execute(query) if not rs.eof then pcStrHPStyle=rs("pcHPS_Style") pcIntHPShowSKU=rs("pcHPS_ShowSKU") pcIntHPShowImg=rs("pcHPS_ShowImg") end if set rs=nothing call closedb() pShowSKU = pcIntHPShowSKU if pShowSKU = "" or isNull(pShowSKU) then pShowSKU = -1 ' If 0, then the SKU is hidden end if pShowSmallImg = pcIntHPShowImg if pShowSmallImg = "" or isNull(pShowSmallImg) then pShowSmallImg = -1 ' If 0, then the Image is hidden end if ' This variable controls whether NOT FOR SALE items should be shown Dim pcIntFeaturedNFS, queryNFS pcIntFeaturedNFS = 0 ' Not for sale items are shown pcIntFeaturedNFS = -1 ' Not for sale items are not shown if pcIntFeaturedNFS <> 0 then queryNFS = " AND formQuantity = 0 " else queryNFS = " " end if '******************************* ' END LOAD HOMEPAGE SETTINGS '******************************* '******************************* ' GET page style '******************************* ' Load the page style: check to see if a querystring ' or a form is sending the page style. Dim pcPageStyle pcPageStyle = LCase(Request.QueryString("pageStyle")) if pcPageStyle = "" then pcPageStyle = LCase(Request.Form("pageStyle")) end if if pcPageStyle = "" then pcPageStyle = pcStrHPStyle end if if pcPageStyle <> "h" and pcPageStyle <> "l" and pcPageStyle <> "m" and pcPageStyle <> "p" then pcPageStyle = LCase(bType) end if '******************************* ' GET page size '******************************* Dim iPageSize iPageSize=(scPrdRow*scPrdRowsPerPage) if request.queryString("iPageCurrent")="" then if request.queryString("page")="" then iPageCurrent=1 else iPageCurrent=server.HTMLEncode(request.queryString("page")) end if else iPageCurrent=server.HTMLEncode(request.queryString("iPageCurrent")) end if '******************************* ' GET sorting criteria '******************************* Dim ProdSort, querySort ProdSort="" & request("prodsort") if ProdSort="" then ProdSort="0" end if select case ProdSort Case "0": querySort = " ORDER BY pcprod_OrdInHome asc" Case "1": querySort = " ORDER BY products.description Asc" Case "2": If Session("customerType")=1 then querySort = " ORDER BY products.btoBprice desc, products.price Desc" else querySort = " ORDER BY products.price Desc" End if Case "3": If Session("customerType")=1 then querySort = " ORDER BY products.bToBprice Asc, products.price Asc" else querySort = " ORDER BY products.price Asc" end if end select '******************************* ' GET featured items from DB '******************************* call openDb() if session("CustomerType")<>"1" then query1= " AND categories.pccats_RetailHide=0" else query1="" end if query="SELECT distinct products.idProduct,products.sku,products.description,products.price,products.listPrice,products.listHidden,products.serviceSpec,products.listPrice,products.bToBPrice,products.smallImageUrl, products.pcprod_HideBTOPrice,products.noprices,products.stock,products.noStock,products.formQuantity,products.pcProd_BackOrder,products.pcprod_OrdInHome FROM products,categories_products,categories WHERE products.active=-1 AND products.showInHome=-1 AND products.configOnly=0 AND products.removed=0 " & queryNFS & " AND categories_products.idProduct=products.idProduct AND categories.idCategory=categories_products.idCategory AND categories.iBTOhide=0 " & query1 & querySort set rsProducts=Server.CreateObject("ADODB.Recordset") rsProducts.CursorLocation=adUseClient rsProducts.CacheSize=iPageSize rsProducts.Open query, conntemp ' Create additional recordset for M display if pcPageStyle = "m" then set rsCount=server.CreateObject("ADODB.Recordset") set rsCount=conntemp.execute(query) end if if err.number<>0 then call LogErrorToDatabase() set rsProducts=nothing call closedb() response.redirect "techErr.asp?err="&pcStrCustRefID end if '******************************* ' Check for EMPTY recordset '******************************* if rsProducts.eof then call closeDb() response.redirect "msg.asp?message=89" end if '******************************* ' Set variables for "M" display '******************************* if pcPageStyle = "m" then 'Check if customers are allowed to order products dim iShow iShow=0 If scOrderlevel=0 then ' Anybody can order iShow=1 end if If scOrderlevel=1 AND session("customerType")="1" then ' Only wholesale customers can order iShow=1 End if Dim pCnt,pBTOCnt,pOptCnt,pAddtoCart 'reset count variables pCnt=Cint(0) pBTOCnt=Cint(0) pOptCnt=Cint(0) 'Run through the products to count all products, products with options, and BTO products do while not rsCount.eof and count < rsProducts.PageSize pCnt=pCnt+1 pidrelation=rsCount("idProduct") pserviceSpec=rsCount("serviceSpec") '// CHECK FOR OPTIONS pcv_intOptionsExist=pcf_CheckForOptions(pidrelation) '// check options function (1=YES, 2=NO) 'response.write pidrelation if pserviceSpec=true or (pcv_intOptionsExist = 1) then If pcv_intOptionsExist = 1 Then pOptCnt=pOptCnt+1 Else pBTOCnt=pBTOCnt+1 End If End If rsCount.moveNext loop set rsCount = nothing ' If all items on the page are either BTO or have options, ' do not show the quantity column or the Add to Cart button. if cint(pOptCnt) + cint(pBTOCnt) <> cint(pCnt) then pAddtoCart = 1 end if end if '******************************* ' Build the page '******************************* %>

<%response.write dictLanguage.Item(Session("language")&"_mainIndex_7")%>

<%if HideSortPro<>"1" then%>
<%=dictLanguage.Item(Session("language")&"_viewCatOrder_5")%>
<%end if%> <% '******************************* ' Determine page count ' Insert page navigation (top) ' Page navigation is also shown at the bottom '******************************* dim iPageCount, count rsProducts.MoveFirst rsProducts.PageSize=iPageSize iPageCount=rsProducts.PageCount rsProducts.AbsolutePage=iPageCurrent %>
<% if pcPageStyle = "m" then %>
<% end if %> <% '******************************* ' Add table headers for display ' styles L and M '******************************* %> <% if pcPageStyle = "l" then %> <% if pShowSmallImg <> 0 then %> <% end if %> <% if pShowSku <> 0 then %> <% end if %> <% elseif pcPageStyle = "m" then %> <% if iShow=1 then %> <% if pAddtoCart = 1 then %> <% end if %> <% end if %> <% if pShowSmallImg <> 0 then %> <% end if %> <% if pShowSku <> 0 then %> <% end if %> <% else %> <% end if %> <% '******************************* ' End table headers '******************************* '******************************* ' Load product information ' Loop through the products '******************************* 'Set the product count to zero count=0 if pcPageStyle = "m" then pCnt=0 pSQty=0 pBTOCnt=Cint(0) pOptCnt=Cint(0) end if 'Loop until the total number of products to show Do While Not rsProducts.eof and count < rsProducts.PageSize if pcPageStyle = "m" then pCnt=pCnt+1 end if pidProduct=rsProducts("idProduct") pSku=rsProducts("sku") pDescription=rsProducts("description") pPrice=rsProducts("price") pListPrice=rsProducts("listprice") pListHidden=rsProducts("listhidden") pBtoBPrice=rsProducts("bToBPrice") pSmallImageUrl=rsProducts("smallImageUrl") pserviceSpec=rsProducts("serviceSpec") pnoprices=rsProducts("noprices") if not pnoprices<>"" then pnoprices=0 end if pcv_intHideBTOPrice=rsProducts("pcprod_HideBTOPrice") if not pcv_intHideBTOPrice<>"" then pcv_intHideBTOPrice="0" end if if pnoprices=2 then pcv_intHideBTOPrice=1 end if pcv_intBackOrder=rsProducts("pcProd_BackOrder") if pcPageStyle = "m" then pidrelation=rsProducts("idProduct") '// CHECK FOR OPTIONS pcv_intOptionsExist=pcf_CheckForOptions(pidrelation) '// check options function (1=YES, 2=NO) 'response.write pidrelation pStock=rsProducts("stock") pNoStock=rsProducts("noStock") pFormQuantity=rsProducts("FormQuantity") end if '// Get sDesc query="SELECT sDesc FROM products WHERE idProduct="&pidProduct&";" set rsDescObj=server.CreateObject("ADODB.RecordSet") set rsDescObj=conntemp.execute(query) psDesc=rsDescObj("sDesc") set rsDescObj=nothing %> <% '******************************* ' Show product information ' depending on the page style '******************************* ' FIRST STYLE - Show products horizontally, with images if pcPageStyle = "h" then %> <% i=i + 1 If i > (scPrdRow-1) then response.write "" i=0 End If end if ' SECOND STYLE - Show products vertically, with images if pcPageStyle = "p" then %> <% end if ' THIRD STYLE - Show a list of products, with a small image if pcPageStyle = "l" then %> <% end if ' FOURTH STYLE - Show a list of products, with multiple add to cart if pcPageStyle = "m" then %> <% end if iRecordsShown=iRecordsShown + 1 count=count + 1 rsProducts.MoveNext loop %>
 <% response.write dictLanguage.Item(Session("language")&"_viewCat_P_9") %><% response.write dictLanguage.Item(Session("language")&"_viewCat_P_8") %><% response.write dictLanguage.Item(Session("language")&"_viewCat_P_10") %>
<% response.write dictLanguage.Item(Session("language")&"_viewCat_P_12") %>
<% response.write dictLanguage.Item(Session("language")&"_viewCat_P_7") %>   <% response.write dictLanguage.Item(Session("language")&"_viewCat_P_8") %> <% response.write dictLanguage.Item(Session("language")&"_viewCat_P_9") %> <% If session("customerType")="1" then response.write dictLanguage.Item(Session("language")&"_viewCat_P_11") else response.write dictLanguage.Item(Session("language")&"_viewCat_P_10") end if %>
<% ' If page style is M, show the Add to Cart button when ' products can be added to the cart from this page. if pcPageStyle = "m" then %> <% if iShow=1 and clng(pSQty)<>0 then %> " id="submit"> <% end if %>
<% end if %> <% set rsProducts=Nothing set iPageCurrent=Nothing call closeDb() %>