<%@ Language=VBScript %> <% '************************************************************************* ' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK! ' Function : "Home" Page for Store Front ' Product : CandyPress Store Frontend ' Version : 5.1 ' Modified : May 2007 ' Copyright: Copyright (C) 2004 Webs Unlimited, Inc. ' See "license.txt" for this product for details regarding ' licensing, usage, disclaimers, distribution and general ' copyright requirements. If you don't have a copy of this ' file, you may request one at http://www.candypress.com '************************************************************************* ' Date Description ' 10/04/08 Add reference to usermods/_INCtools_.asp ' 03/31/09 Added UOM to product price display '************************************************************************* ' 02/07/10 : Removed tables, replaced with div - candythemes.com '************************************************************************* Option explicit Response.Buffer = true %> <% 'Database dim mySQL dim conntemp dim rstemp dim rstemp2 'Session dim idOrder dim idCust dim userroles '************************************************************************* 'Open Database Connection call openDB() 'Store Configuration if loadConfig() = false then call errorDB("Unable to load store configuration table values") end if 'Get/Set Cart/Order Session idOrder = sessionCart() 'Get/Set Customer Session idCust = sessionCust() 'Get/Set Affilate ID call getIdAffiliate(validHTML(Request.QueryString("idAff"))) %> <% 'Close Database Connection call closeDB() '********************************************************************** 'Main Shopping Cart Display Area. '********************************************************************** sub cartMain() %>
<% 'Get Featured Products mySQL="SELECT idProduct,description,descriptionLong," _ & " listPrice,price,wholesaleprice,smallImageUrl,stock," _ & " fileName,noShipCharge,sortOrder,handlingFee,idUom " _ & "FROM " & tablePrefix & "products " _ & "WHERE active = -1 " _ & "AND homePage = -1 " _ & "AND hotDeal <> -1 " _ & "ORDER BY sortOrder ASC,idProduct DESC " set rsTemp = openRSopen(mySQL,adUseClient,adOpenStatic,adLockOptimistic,adCmdText,0) 'Randomize the recordset if homeViewRandom > 0 and rsTemp.RecordCount > 2 then 'Disconnect recordset and initialize random seed set rsTemp.ActiveConnection = nothing randomize() 'Update sortOrder field with random numbers and sort do while not rsTemp.EOF rsTemp.Update "sortOrder",Int((9999 * Rnd) + 1) rsTemp.MoveNext loop rsTemp.Sort = "sortOrder" 'Delete any extra records from disconnected recordset rsTemp.move homeViewRandom,1 do while not rsTemp.EOF rsTemp.Delete rsTemp.MoveNext loop 'Reposition to first record rsTemp.MoveFirst end if 'If Featured Products = 0 then use "_INCright_.asp" if rsTemp.EOF or showFeaturedProducts = 0 then call noProd() else 'If Featured Products <= 2 then display single rows if rsTemp.RecordCount <= 2 then do while not rsTemp.EOF call singleProd() if not rsTemp.EOF then rsTemp.MoveNext end if loop 'If Featured Products > 2 then display double rows else do while not rsTemp.EOF select case homecolumns case 1: call singleProd() case 2: call doubleProd() case 3: call tripleProd() case else: call singleProd() end select if not rsTemp.EOF then rsTemp.MoveNext end if loop end if end if %>
<% end sub '********************************************************************** 'Displayed when there are no Featured Products. '********************************************************************** sub noProd() %> <% end sub '********************************************************************** 'Displays ONE Featured Product across the width of a row. '********************************************************************** sub singleProd() %>
<%call prodImage()%>
<%call prodDetail()%>
 
<% end sub '********************************************************************** 'Displays TWO Featured Products across the width of a row. '********************************************************************** sub doubleProd() %>
<%call prodImage2col()%>
<%call prodDetail()%>
 
<% rsTemp.MoveNext if rsTemp.EOF then %> <% exit sub end if %>
<%call prodImage2col()%>
<%call prodDetail()%>
 
 
<% end sub '********************************************************************** 'Displays Three Featured Products across the width of a row. '********************************************************************** sub tripleProd() %>
<%call prodImage()%> <%call prodDetail()%>
<% rsTemp.MoveNext if rsTemp.EOF then %> <% exit sub end if %>
<%call prodImage()%> <%call prodDetail()%>
<% rsTemp.MoveNext if rsTemp.EOF then %> <% exit sub end if %>
<%call prodImage()%> <%call prodDetail()%>
<% end sub '********************************************************************** 'Writes the product detail '********************************************************************** sub prodDetail() %>

<%=langProduct(rsTemp("idProduct"),"description",rsTemp("description"))%>

<%=trim(langProduct(rsTemp("idProduct"),"descriptionLong",rsTemp("descriptionLong")))%>

<% 'Show pricing if required for this product if not(pHidePricingZero=-1 and rsTemp("Price")=0) then 'Assign pricing info to local variables for easier use. dim listPrice, price, wholesaleprice, handlingFee listPrice = rsTemp("listPrice") price = rsTemp("price") wholesaleprice = rsTemp("wholesaleprice") handlingFee = rsTemp("handlingFee") listPrice = Exchange(listPrice) price = Exchange(price) wholesaleprice = Exchange(wholesaleprice) handlingFee = Exchange(handlingFee) idCust = sessionCust() if Not IsNull(idCust) then userroles = session(storeID & "userroles") if (CInt(userroles) and CInt(WHOLESALER)) then if price > wholesaleprice then price = wholesaleprice end if end if 'Show Extended layout. if homeViewLayout = 1 then if listPrice > Price then %> <%=LangText("GenListPrice","")%>: <%=moneyS(listPrice)%>
<% end if %> <%=LangText("GenOurPrice","")%>: <%=moneyS(Price)%> <%=getUOMabbr(rsTemp("idUOM"))%> <% if handlingFee > 0 then %> <%=LangText("GenHandlingFee","")%>: <%=moneyS(handlingFee)%>
<% end if if (listPrice - Price) > 0 then %>
<%=LangText("GenYouSave","")%>: <%=moneyS(listPrice-Price)%> (<%=formatNumber((((listPrice-Price)/listPrice)*100),0)%>%) <% end if 'Show Classic layout. else %> <%=LangText("GenOurPrice","")%>: <%=moneyS(Price)%> <% if handlingFee > 0 then %>
+ <%=LangText("GenHandlingFee","")%>: <%=moneyS(handlingFee)%> <% end if end if %> <% end if 'Show Extended layout. if homeViewLayout = 1 then 'Free Shipping? if UCase(rsTemp("noShipCharge")) = "Y" and len(trim(rsTemp("fileName")&"")) = 0 then %> <%=LangText("GenFreeShipping","")%>
<% end if 'In stock, Out of stock if pShowStockView = -1 then if pHideAddStockLevel = -1 then %> <%=LangText("GenInStock","")%>
<% else if rsTemp("stock") > pHideAddStockLevel then %> <%=LangText("GenInStock","")%>
<% else %> <%=LangText("GenOutStock","")%>
<% end if end if end if end if end sub '********************************************************************** 'Writes the code to display the product image and a link '********************************************************************** sub prodImage() dim smallImageURL smallImageURL = trim(rsTemp("smallImageUrl") & "") if len(smallImageURL) <> 0 then %> "><%=server.HTMLEncode(rsTemp(" <%=ImageResize(server.mappath(pImagesDir & smallImageURL),pWList,pHList,"list")%> /> <% else %> <%=LangText("GenNoImage","")%> <% end if %> <% end sub sub prodImage2col() dim smallImageURL2 smallImageURL2 = trim(rsTemp("smallImageUrl") & "") if len(smallImageURL2) <> 0 then %> "><%=server.HTMLEncode(rsTemp(" <%=ImageResize(server.mappath(pImagesDir & smallImageURL2),pWThumb,pHThumb,"thumb")%> /> <% else %> <%=LangText("GenNoImage","")%> <% end if %> <% end sub %>