<% '************************************************************************* ' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK! ' Function : Display details for a specific product, including all ' : options. ' Product : Shopping Tree Store Frontend ' Version : 3.3 ' Modified : January 2005 ' Copyright: Copyright (C) 2004 Shopping Tree.Com ' 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 webmaster@ShoppingTree.com '************************************************************************* ' Date Description ' 10/23/05 Added user exit ' 11/20/05 Corrected problem with price display in getProdRelated(); ' '************************************************************************* Response.Buffer = true %> <% 'Product dim Description dim DescriptionLong dim Price dim Details dim relatedKeys dim listPrice dim smallImageURL dim imageURL dim Stock dim SKU dim fileName dim noShipCharge dim reviewAllow dim handlingFee dim a1 dim audioA1 dim a2 dim audioA2 dim b1 dim audioB1 dim b2 dim audioB2 dim weight 'Options dim priceToAdd dim percToAdd 'Work Fields dim testMode dim revCount dim revSum dim numMandatoryOpt dim optSize 'Database dim mySQL dim conntemp dim rstemp dim rstemp2 dim rsTemp3 dim cats 'Work dim idCust dim idOrder '************************************************************************* selectedLang = request.Form("language") if len(selectedLang) = 2 then session("language") = selectedLang response.cookies("language") = selectedLang response.Cookies("language").expires = dateAdd("d",30,now()) else selectedLang= Request.queryString("language") if len(selectedLang) = 2 then session("language") = selectedLang response.cookies("language") = selectedLang response.Cookies("language").expires = dateAdd("d",30,now()) end if end if 'Open Database Connection call openDb() 'Store Configuration if loadConfig() = false then call errorDB(LangText("ErrConfig",""),"") end if 'Get/Set Cart/Order Session idOrder = sessionCart() 'Get/Set Customer Session idCust = sessionCust() if not IsNumeric(idCust) then idCust = session.sessionID 'Get/Set Affilate ID call getIdAffiliate(Request.QueryString("idAff")) 'Check Product Code 'idProduct = trim(request("idProduct")&"") if not IsNumeric(idProduct) then 'Check SKU sku = trim(request("sku")&"") if len(sku) > 0 then mySQL = "SELECT idProduct " _ & "FROM products " _ & "WHERE sku = '" & validSQL(sku,"A") & "' " set rsTemp = openRSexecute(mySQL) if not rsTemp.EOF then idProduct = rsTemp("idProduct") else response.redirect siteRoot() & "/Scripts/sysMsg.asp?errMsg=this" & server.URLEncode(LangText("ErrInvProdID","")) end if call closeRS(rsTemp) else response.redirect siteRoot() & "/Scripts/sysMsg.asp?errMsg=that" & server.URLEncode(LangText("ErrInvProdID","")) end if end if 'Check if Product is being displayed as a Test if Instr(lCase(Request.ServerVariables("HTTP_REFERER")),"/sa_prod") = 0 then testMode = false else testMode = true end if 'Get Product Detail mySQL = "SELECT description,descriptionLong,relatedKeys,price," _ & " listprice,smallImageUrl,imageurl,stock,sku," _ & " fileName,noShipCharge,reviewAllow,details,weight,handlingFee," _ & " a1,audioA1,a2,audioA2,b1,audioB1,b2,audiob2 " _ & "FROM products " _ & "WHERE idProduct = " & validSQL(idProduct,"I") & " " if not testMode then mySQL = mySQL & "AND active = -1" end if set rsTemp = openRSexecute(mySQL) if rsTemp.eof then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode(LangText("ErrInvProdID","")) end if 'Assign product DB fields to local fields relatedKeys = trim(rsTemp("relatedKeys")&"") Price = rsTemp("price") listPrice = rsTemp("listPrice") smallImageURL = trim(rsTemp("SmallImageUrl")&"") imageURL = trim(rsTemp("imageUrl")&"") Stock = rsTemp("stock") sku = trim(rsTemp("sku")&"") fileName = trim(rsTemp("fileName")&"") noShipCharge = trim(rsTemp("noShipCharge")&"") reviewAllow = trim(rsTemp("reviewAllow")&"") handlingFee = rsTemp("handlingFee") weight = rsTemp("weight") a1 = rstemp("a1") audioA1 = rstemp("audioA1") a2 = rstemp("a2") audioA2 = rstemp("audioA2") b1 = rstemp("b1") audioB1 = rstemp("audioB1") b2 = rstemp("b2") audioB2 = rstemp("audioB2") 'Language for product descriptions Details = trim(langProduct(idProduct,"details",rsTemp("details"))) Description = trim(langProduct(idProduct,"description",rsTemp("description"))) DescriptionLong = trim(langProduct(idProduct,"DescriptionLong",rsTemp("DescriptionLong"))) closeRS(rsTemp) 'Build a category keyword string mySQL = "SELECT Categories_Products.idProduct, Categories.categoryDesc " _ & "FROM Categories_Products INNER JOIN Categories ON Categories_Products.idCategory = Categories.idCategory " _ & "WHERE (((Categories_Products.idProduct)= " & idProduct & "));" set rsTemp = openRSexecute(mySQL) do while not rsTemp.eof cats = cats & trim(rsTemp("categoryDesc")) & "," rsTemp.moveNext loop if len(cats) > 0 then cats = mid(cats,1,len(cats) - 1) closeRS(rsTemp) %> <% 'Close Database Connection call closeDb() '************************************************************************* 'Main Shopping Cart Display Area '************************************************************************* sub cartMain() ' Adjust for displayed currency listPrice = Exchange(listPrice) price = Exchange(price) response.write "

" & Request.QueryString("Msg") & "


" %>
<%if pShowStockView = -1 then %> <%end if%> <%if pShowStockView = -1 then %> <%end if%> <%if a2 <>"" then%> <%if pShowStockView = -1 then %> <%end if%> <% end if%> <%if b1 <>"" then%> <%if pShowStockView = -1 then %> <%end if%> <% end if%> <%if b2 <>"" then%> <%if pShowStockView = -1 then %> <%end if%> <% end if%>
ITEM NO (SKU)
ARTIST / EP TITLE
TRACK TITLE
LISTEN
STOCK
PRICE
BUY
<%=sku%>
<%=Description%>
<%=a1%>
<%call getStockLevel()%>
<%call getPricing(0)%>
<%call getQtyAndAdd()%>
<%=sku%>
<%=Description%>
<%=a2%>
 
 
 
<%=sku%>
<%=Description%>
<%=b1%>
 
 
 
<%=sku%>
<%=Description%>
<%=b2%>
 
 
 
<%call getMisc()%>

<% end sub '************************************************************************* ' Display Qty box and Add Button '************************************************************************* sub getQtyAndAdd() if pCatalogOnly = 0 and _ (pHideAddStockLevel = -1 or _ pHideAddStockLevel < CDbl(Stock)) then %>
<%if weight=0 then%>
<%else%>
<%end if%>
<% end if end sub '************************************************************************* ' Display Miscellaneous items '************************************************************************* sub getMisc() if mailComp <> 0 or demoMode = "Y" then %>
<%=LangText("GenMiscellaneous","")%> :
<%=LangText("GenEmailFriendHdr","")%>
"><%=LangText("GenProdInquiry","")%>
<% end if end sub '************************************************************************* ' Display "Favorites" '************************************************************************* sub getFavorites if FavoritesEnabled = "-1" then %> <%=LangText("GenAddFav","Add to Favorites")%>
<% end if end sub '************************************************************************* ' Display "Wish List" '************************************************************************* sub getWishList if WishlistEnabled = "-1" then %> <%=LangText("GenAddWishlist","Add to Wish List")%> <% end if end sub '************************************************************************* ' Display "Mandatory" message '************************************************************************* sub getMandatoryMsg() if numMandatoryOpt > 0 then %>
(*) <%=LangText("GenMandatoryOpt","")%>
<% end if end sub 'Display Stock Level Message '********************************************************************* sub getStockLevel() if stock > pHideAddStockLevel then %> <%=LangText("GenInStock","")%>
<% else %> <%=LangText("GenOutStock","")%>
<% end if end sub '********************************************************************* 'Display prices 'priceDispType : 0 = Show List, Price, Discount amount ' : 1 = Show Price Only '********************************************************************* sub getPricing(priceDispType) 'Assign pricing info to local variables for easier use. listPrice = Exchange(listPrice) price = Exchange(price) handlingFee = Exchange(handlingFee) if not(pHidePricingZero=-1 and Price=0) then if listPrice > Price and priceDispType = 0 then %> <%=LangText("GenListPrice","")%>: <%=moneyS(ListPrice)%>
<% end if %> <%=moneyS(Price)%>
<% if (listPrice - Price) > 0 and priceDispType = 0 then %> <%=LangText("GenYouSave","")%>: <%=moneyS(listPrice-Price)%> (<%=formatNumber((((listPrice-Price)/listPrice)*100),0)%>%)
<% end if if handlingFee > 0 then %> <%=LangText("GenHandlingFee","")%>: <%=moneyS(HandlingFee)%>
<% end if end if end sub %>