<% ' Comersus 4.2x Sophisticated Cart ' Developed by Rodrigo S. Alhadeff ' July-2002 ' Open Source License can be found at License.txt ' http://www.comersus.com ' Details: dynamic home: get products marked as showInHome %> <% on error resume next dim connTemp, rsTemp, rsTemp3, pRowsShown, pMaxPopularity ' get settings pDefaultLanguage = getSettingKey("pDefaultLanguage") pStoreFrontDemoMode = getSettingKey("pStoreFrontDemoMode") pCurrencySign = getSettingKey("pCurrencySign") pDecimalSign = getSettingKey("pDecimalSign") pCompany = getSettingKey("pCompany") pCompanyLogo = getSettingKey("pCompanyLogo") pAuctions = getSettingKey("pAuctions") pListBestSellers = getSettingKey("pListBestSellers") pNewsLetter = getSettingKey("pNewsLetter") pPriceList = getSettingKey("pPriceList") pStoreNews = getSettingKey("pStoreNews") pOneStepCheckout = getSettingKey("pOneStepCheckout") pShowStockView = getSettingKey("pShowStockView") ' defines how many rows it will show in the home (consider that if there are no enough products you will get empty cells) pRowsShown = getSettingKey("pRowsShown") pMaxPopularity = 0 arrCounter = 0 pIdCustomer = getSessionVariable("idCustomer",0) pIdCustomerType = getSessionVariable("idCustomerType",1) ' get how many products are marked as showInHome mySQL="SELECT COUNT(idProduct) as howManyHome FROM products WHERE showInHome=-1 AND active=-1" call getFromDatabase (mySql, rsTemp3, "dynamic_index") if rsTemp3.eof then howManyHome=0 else howManyHome=rstemp3("howManyHome") end if if Cint(howManyHome)")=0 then arrProducts(arrCounter,2)= left(pDetails,180)&"..." arrProducts(arrCounter,3)= rstemp3("price") arrProducts(arrCounter,4)= rstemp3("smallimageUrl") arrProducts(arrCounter,5)= rstemp3("stock") arrProducts(arrCounter,6)= rstemp3("bToBprice") arrProducts(arrCounter,7)= rstemp3("visits") arrCounter = arrCounter+1 rstemp3.moveNext loop pMaxPopularity=getMax(arrProducts) ' get 1 to 5 main categories (root) mySQL="SELECT idCategory, categoryDesc FROM categories WHERE idParentCategory=1 AND idCategory<>1 ORDER BY categoryDesc" call getFromDatabase (mySql, rsTemp, "dynamic_index") ' define the array to store categories reDim arrCategories(5,2) arrCounter=0 do while not rstemp.eof and arrCounter<5 arrCategories(arrCounter,0)=rstemp("idCategory") arrCategories(arrCounter,1)=rstemp("categoryDesc") arrCounter=arrCounter+1 rstemp.movenext loop %>
<% pItemCounter=0 for f=0 to pRowsShown-1 %> <%' column %> <%' Cell 2 %> <%next%>



<%if arrProducts(pItemCounter,4)<>"" then%>
<%=arrProducts(pItemCounter,1)%> <%else%> Image not available <%end if%> <%=arrProducts(pItemCounter,1)%>

<%=arrProducts(pItemCounter,2)%>
<%=dictLanguage.Item(Session("language")&"_dynamicindex_2")%>

<%if pIdCustomerType=1 or arrProducts(pItemCounter,6)=0 then%> <%=dictLanguage.Item(Session("language")&"_dynamicindex_3") &pCurrencySign & money(arrProducts(pItemCounter,3))%> <%else%> <%=dictLanguage.Item(Session("language")&"_dynamicindex_3") &pCurrencySign & money(arrProducts(pItemCounter,6))%> <%end if%> <%if pShowStockView="-1" then%> (<%=dictLanguage.Item(Session("language")&"_dynamicindex_9")%>: <%=arrProducts(pItemCounter,5)%>) <%end if%>

<%pItemCounter=pItemCounter+1%>

   
<%if arrProducts(pItemCounter,4)<>"" then%>
<%=arrProducts(pItemCounter,1)%> <%else%> Image not available <%end if%> <%=arrProducts(pItemCounter,1)%>

<%=arrProducts(pItemCounter,2)%>
<%=dictLanguage.Item(Session("language")&"_dynamicindex_2")%>

<%if pIdCustomerType=1 or arrProducts(pItemCounter,6)=0 then%> <%=dictLanguage.Item(Session("language")&"_dynamicindex_3") &pCurrencySign & money(arrProducts(pItemCounter,3))%> <%else%> <%=dictLanguage.Item(Session("language")&"_dynamicindex_3") &pCurrencySign & money(arrProducts(pItemCounter,6))%> <%end if%> <%if pShowStockView="-1" then%> (<%=dictLanguage.Item(Session("language")&"_dynamicindex_9")%>: <%=arrProducts(pItemCounter,5)%>) <%end if%>

<%pItemCounter=pItemCounter+1%>
 
<%if arrProducts(pItemCounter,4)<>"" then%>
<%=arrProducts(pItemCounter,1)%> <%else%> Image not available <%end if%> <%=arrProducts(pItemCounter,1)%>

<%=arrProducts(pItemCounter,2)%>
<%=dictLanguage.Item(Session("language")&"_dynamicindex_2")%>

<%if pIdCustomerType=1 or arrProducts(pItemCounter,6)=0 then%> <%=dictLanguage.Item(Session("language")&"_dynamicindex_3") &pCurrencySign & money(arrProducts(pItemCounter,3))%> <%else%> <%=dictLanguage.Item(Session("language")&"_dynamicindex_3") &pCurrencySign & money(arrProducts(pItemCounter,6))%> <%end if%> <%if pShowStockView="-1" then%> (<%=dictLanguage.Item(Session("language")&"_dynamicindex_9")%>: <%=arrProducts(pItemCounter,5)%>) <%end if%>

<%pItemCounter=pItemCounter+1%>



<%' featured categories%>
<%=dictLanguage.Item(Session("language")&"_dynamicindex_10")%>: <% ' only shows 5 categories if arrCounter>4 then arrCounter=4 for h=0 to arrCounter-1%> <%=h+1%>. <%=arrCategories(h,1)%> <%if h<3 then%> | <%end if%> <%next%>
<%if pStoreFrontDemoMode="-1" and pAuctions="0" then%> "><%=dictLanguage.Item(Session("language")&"_dynamicindex_4")%> (new!) | <%elseIf pAuctions="-1" then%> <%=dictLanguage.Item(Session("language")&"_dynamicindex_4")%> (new!) | <%end if%> <%=dictLanguage.Item(Session("language")&"_dynamicindex_5")%> | <%=dictLanguage.Item(Session("language")&"_dynamicindex_6")%> <%if pStoreFrontDemoMode="-1" and pListBestSellers="0" then%> | ">Best Sellers <%elseIf pListBestSellers="-1" then%> | <%=dictLanguage.Item(Session("language")&"_dynamicindex_7")%> <%end if%>


<%call closeDb()%>