%
' Comersus Shopping Cart
' Comersus Open Technologies
' United States
' Software License can be found at License.txt
' http://www.comersus.com
' Details: list items according to filtering
%>
<%
'on error resume next
dim connTemp, rsTemp, rsTemp2
dim pTotalPages, pCounter, pNumPerPage
' get settings.
pStoreFrontDemoMode = getSettingKey("pStoreFrontDemoMode")
pCompanyCountryCode = getSettingKey("pCompanyCountryCode")
pCurrencySign = getSettingKey("pCurrencySign")
pDecimalSign = getSettingKey("pDecimalSign")
pCompany = getSettingKey("pCompany")
pCompanySlogan = getSettingKey("pCompanySlogan")
pShowStockView = getSettingKey("pShowStockView")
pCompareProducts = getSettingKey("pCompareProducts")
pAllowNewCustomer = getSettingKey("pAllowNewCustomer")
pAboutUsLink = getSettingKey("pAboutUsLink")
pShowNews = getSettingKey("pShowNews")
pStoreLocation = getSettingKey("pStoreLocation")
pHeaderKeywords = getSettingKey("pHeaderKeywords")
pMoneyDontRound = getSettingKey("pMoneyDontRound")
pApplyGST = getSettingKey("pGST")
pGSTRate = getSettingKey("pGSTRate")
pAffiliatesStoreFront = getSettingKey("pAffiliatesStoreFront")
pSuppliersList = getSettingKey("pSuppliersList")
pAuctions = getSettingKey("pAuctions")
pAffiliatesStoreFront = getSettingKey("pAffiliatesStoreFront")
pRssFeedServer = getSettingKey("pRssFeedServer")
pNewsLetter = getSettingKey("pNewsLetter")
pProductCustomField1 = getSettingKey("pProductCustomField1")
pProductCustomField2 = getSettingKey("pProductCustomField2")
pProductCustomField3 = getSettingKey("pProductCustomField3")
pIdCustomer = getSessionVariable("idCustomer",0)
pIdCustomerType = getSessionVariable("idCustomerType",1)
pNumPerPage = 9
pCurrentPage = getUserInput(request.querystring("currentPage"),4)
pHotDeal = getUserInput(request.querystring("hotDeal"),2)
pLastChance = getUserInput(request.querystring("lastChance"),2)
pIdSupplier = getUserInput(request.querystring("idSupplier"),8)
pIdCategory = getUserInput(request.querystring("idCategory"),8)
pOrderBy = getUserInput(request.querystring("orderBy"),10)
pStrSearch = formatForDb(getUserInput(request("strSearch"),30))
pUser1 = getUserInput(request.querystring("user1"),50)
pUser2 = getUserInput(request.querystring("user2"),50)
pUser3 = getUserInput(request.querystring("user3"),50)
if pCurrentPage = "" then
pCurrentPage = 1
end if
call customerTracking("comersus_listOneCategory.asp", request.querystring)
' get items.
mySQL = "SELECT DISTINCT products.idProduct, sku, gst, description, visits, listPrice, smallImageUrl, sales, dateAdded, isBundleMain, rental, map FROM products, stock, categories_products WHERE listHidden=0 AND active=-1 AND idStore=" & pIdStore & " AND products.idStock=stock.idStock AND products.idProduct=categories_products.idProduct"
' hot deal.
if pHotDeal <> "" then
mySQL = mySQL & " AND hotDeal=-1"
end if
' last chance.
if pLastChance <> "" then
mySQL = mySQL & " AND stock>0 AND stock<10"
end if
' supplier.
if pIdSupplier <> "" then
mySQL = mySQL & " AND idSupplier=" & pIdSupplier
end if
' category.
if pIdCategory <> "" then
mySQL = mySQL & " AND idCategory=" & pIdCategory
end if
' description search.
if pStrSearch <> "" then
mySQL = mySQL & " AND description LIKE '%" & pStrSearch & "%'"
end if
if pUser1 <> "" then
mySQL = mySQL & " AND user1='" & pUser1 & "'"
end if
if pUser2 <> "" then
mySQL = mySQL & " AND user2='" & pUser2 & "'"
end if
if pUser3 <> "" then
mySQL = mySQL & " AND user3='" & pUser3 & "'"
end if
' order parameters.
if pOrderBy = "descr" then
mySQL = mySQL & " ORDER BY description"
end if
if pOrderBy = "sku" then
mySQL = mySQL & " ORDER BY sku"
end if
if pOrderBy = "visits" then
mySQL = mySQL & " ORDER BY visits DESC"
end if
if pOrderBy = "sales" then
mySQL = mySQL & " ORDER BY sales DESC"
end if
if pOrderBy = "recently" then
mySQL = mySQL & " ORDER BY products.idProduct DESC"
end if
if pLastChance <> "" then
mySQL = mySQL & " ORDER BY stock"
end if
call getFromDatabasePerPage(mySql, rsTemp2, "listItems")
if rsTemp2.eof then
response.redirect "comersus_message.asp?message=" & Server.Urlencode(getMsg(62,"No items"))
end if
rsTemp2.moveFirst
rsTemp2.PageSize = pNumPerPage
pTotalPages = rsTemp2.PageCount
rsTemp2.absolutePage = pCurrentPage
' for best sellers listing, only show 10 results.
if pOrderBy = "sales" then
pNumPerPage = 10
end if
%>
<%=getMsg(63,"Items listing")%> (<%=getMsg(64,"Search crit")%>:
<%if pHotDeal <> "" then%>
<%=getMsg(65,"Clearance")%>
<%end if%>
<%if pLastChance <> "" then%>
<%=getMsg(147,"LC")%>
<%end if%>
<%if pOrderBy = "sales" then%>
<%=getMsg(66,"Top sel")%>
<%end if%>
<%if pIdSupplier <> "" then%>
<%=getMsg(67,"Supplier list")%>
<%end if%>
<%if pIdCategory <> "" then%>
<%=getMsg(284,"Category")%> <%=getCategoryDescription(pIdCategory)%>
<%end if%>
<%if pStrSearch <> "" then%>
<%=getMsg(68,"Kword")%> '<%=pStrSearch%>'
<%end if%>
<%if pUser1 <> "" then%>
<%=pProductCustomField1%> <%=pUser1%>
<%end if%>
<%if pUser2 <> "" then%>
<%=pProductCustomField2%> <%=pUser2%>
<%end if%>
<%if pUser3 <> "" then%>
<%=pProductCustomField3%> <%=pUser3%>
<%end if%>
<%=getMsg(69,"ordered by")%>:
<%
select case pOrderBy
case "descr"
response.write getMsg(70,"desc")
case "sku"
response.write getMsg(71,"sku")
case "visits"
response.write getMsg(72,"popul")
case "sales"
response.write getMsg(73,"sales")
case "recently"
response.write getMsg(74,"rece added")
case ""
response.write getMsg(75,"no order")
end select
%>
)
<%
pCounter = 0
pColumnCounter = 1
do while not rsTemp2.eof and pCounter < pNumPerPage
pIdProduct = rsTemp2("idProduct")
pSku = rsTemp2("sku")
pDescription = rsTemp2("description")
pListPrice = rsTemp2("listPrice")
pSmallImageUrl = rsTemp2("smallImageUrl")
pStock = getStock(pIdProduct)
pIsBundleMain = rsTemp2("isBundleMain")
pRental = rsTemp2("rental")
pVisits = rsTemp2("visits")
pDateAdded = rsTemp2("dateAdded")
pMapPrice = rstemp2("map")
pPrice = getPrice(pIdProduct, pIdCustomerType, pIdCustomer)
pGST = rsTemp2("gst")
%>
<%if pColumnCounter = 1 then%>
<%end if%>
<%if pSmallImageUrl <> "" then%>
|
|
<%else%>
|
<%end if%>
| <%=pDescription%> |
<%if pMapPrice = "-1" then%>
<%=getMsg(2,"price")%> |
: |
[<%=getMsg(745,"add to cart to find out")%>] |
<%else%>
<%=getMsg(2,"price")%> |
: |
<%=pCurrencySign & money(pPrice)%> |
<%end if%>
<%if pCompanyCountryCode = "AU" and pApplyGST = "-1" then%>
<%if pGST = "-1" then%>
<%pItemGST = pPrice * pGSTRate%>
GST |
: |
<%=pCurrencySign & money(pItemGST)%> |
Total |
: |
<%=pCurrencySign & money(pPrice + pItemGST)%> |
<%else%>
GST |
: |
Exempt |
<%end if%>
<%end if%>
<%=getMsg(60,"visits")%> |
: |
<%=pVisits%> |
<%if pShowStockView = "-1" then%>
(<%=getMsg(3,"Stock")%> |
: |
<%=pStock%>) |
<%end if%>
<%if pCompareProducts = "-1" then%>
|
<%end if%>
|
|
<%if pColumnCounter=3 then%>
<%end if%>
<%
pCounter = pCounter + 1
pColumnCounter = pColumnCounter + 1
if pColumnCounter = 4 then
pColumnCounter = 1
end if
rsTemp2.moveNext
loop
%>
<%if pColumnCounter = 2 then%>
| |
<%end if%>
<%if pColumnCounter = 3 then%>
|
<%end if%>
<%call closeDb()%>