<% ' Comersus 4.2x Sophisticated Cart ' Developed by Rodrigo S. Alhadeff ' Dic-2002 ' Open Source License can be found at License.txt ' http://www.comersus.com ' Details: view item details, increase visits %> <% on error resume next dim connTemp, rsTemp, mySql, pIdProduct, pDescription, pPrice, pDetails, pListPrice, pImageUrl, pWeight ' set affiliate pIdAffiliate=getUserInput(request.querystring("idAffiliate"),4) if isNumeric(pIdAffiliate)then session("idAffiliate")= pIdAffiliate end if ' get settings pDefaultLanguage = getSettingKey("pDefaultLanguage") pStoreFrontDemoMode = getSettingKey("pStoreFrontDemoMode") pCurrencySign = getSettingKey("pCurrencySign") pDecimalSign = getSettingKey("pDecimalSign") pCompany = getSettingKey("pCompany") pCompanyLogo = getSettingKey("pCompanyLogo") pCurrencyConversion = getSettingKey("pCurrencyConversion") pShowBtoBPrice = getSettingKey("pShowBtoBPrice") pShowStockView = getSettingKey("pShowStockView") pProductReviews = getSettingKey("pProductReviews") pNoStockAvoidAdding = getSettingKey("pNoStockAvoidAdding") pEmailToFriend = getSettingKey("pEmailToFriend") pWishList = getSettingKey("pWishList") pStoreNews = getSettingKey("pStoreNews") pRelatedProducts = getSettingKey("pRelatedProducts") pNewsLetter = getSettingKey("pNewsLetter") pAuctions = getSettingKey("pAuctions") pGetRelatedProductsLimit= getSettingKey("pGetRelatedProductsLimit") pIdProduct = getUserInput(request.queryString("idProduct"),10) if trim(pIdProduct)="" or IsNumeric(pIdProduct)=false then response.redirect "message.asp?message="&Server.Urlencode(dictLanguage.Item(Session("language")&"_viewitem_1") ) end if pIdCustomer = getSessionVariable("idCustomer",0) pIdCustomerType = getSessionVariable("idCustomerType",1) ' increase visits to the product mySQL="UPDATE products SET visits=visits+1 WHERE idProduct="& pIdProduct call updateDatabase(mySQL, rsTemp, "ViewItem") ' check for discount per quantity mySQL="SELECT idDiscountperquantity FROM discountsperquantity WHERE idProduct=" &pIdProduct call getFromDatabase (mySql, rsTemp, "ViewItem") if not rstemp.eof then pDiscountPerQuantity=-1 else pDiscountPerQuantity=0 end if ' check for auctions mySQL="SELECT idAuction FROM auctions WHERE active=-1 AND idProduct=" &pIdProduct call getFromDatabase (mySql, rsTemp, "ViewItem") if not rstemp.eof then pAuctionAvailable=-1 pIdAuction=rstemp("idAuction") else pAuctionAvailable=0 end if ' gets item details from db mySQL="SELECT description, price, bToBprice, details, listprice, imageurl, stock, sku, formQuantity, hasPersonalization FROM products WHERE idProduct=" &pidProduct& " AND active=-1" call getFromDatabase (mySql, rsTemp, "ViewItem") if rsTemp.eof then response.redirect "message.asp?message="&Server.Urlencode(dictLanguage.Item(Session("language")&"_viewitem_2") ) end if pDescription = rsTemp("description") pPrice = rsTemp("price") pBtoBPrice = rsTemp("bToBPrice") pDetails = rsTemp("details") pListPrice = rsTemp("listPrice") pimageUrl = rsTemp("imageUrl") pStock = rsTemp("stock") pSku = rsTemp("sku") pFormQuantity = rsTemp("formQuantity") pHasPersonalization = rsTemp("hasPersonalization") switchProductsLanguage session("language"), pIdProduct, pDetails, pDescription ' special price flag pSpecialPrice=0 ' change prices depending on special prices asigned switchSpecialPrice pIdCustomer, pIdProduct, pPrice, pBtoBPrice, pSpecialPrice %>

<%=pSku& " " &pDescription%>

<%if pImageUrl<>"" then%> <%else%> <%end if%>


<%=pDetails%>

<%=dictLanguage.Item(Session("language")&"_viewitem_3")%> <%=pCurrencySign & money(pPrice)%> <%if pStoreFrontDemoMode="-1" and pCurrencyConversion="none" then%> "><%= dictLanguage.Item(Session("language")&"_viewitem_25")%> <%end if%> <%if pCurrencyConversion="static" then%> <%= dictLanguage.Item(Session("language")&"_viewitem_25")%> <%end if%> <%if pCurrencyConversion="dynamic" then%> <%= dictLanguage.Item(Session("language")&"_viewitem_25")%> <%end if%>
<%if pBtoBPrice>0 and (pShowBtoBPrice="-1" or pIdCustomerType=2) and pSpecialPrice=0 then%> <%= dictLanguage.Item(Session("language")&"_viewitem_15") &" "%> <%=pCurrencySign & money(pBtoBPrice)%>
<%if (pPrice-pBtoBPrice)>0 and pIdCustomerType=2 then%> <%= dictLanguage.Item(Session("language")&"_viewitem_4")%> <%=pCurrencySign & money((pPrice-pBtoBPrice))%>
<%end if%> <%end if%> <%if ((pListPrice-pPrice)>0 and pIdCustomerType=1) then%> <%= dictLanguage.Item(Session("language")&"_viewitem_26")%> <%=pCurrencySign & money((pListPrice))%> ~ <%= dictLanguage.Item(Session("language")&"_viewitem_4")%> <%=pCurrencySign & money((pListPrice-pPrice))%>
<%end if%> <%if pShowStockView="-1" then response.write dictLanguage.Item(Session("language")&"_viewitem_19") &" "&pStock& "
" end if%> <%if pProductReviews="-1" then ' get review data mySQL="SELECT SUM(stars) AS sumStars, COUNT(*) AS countReviews FROM reviews WHERE idProduct=" &pIdProduct& " AND active=-1" call getFromDatabase (mySql, rsTemp, "viewItem") if not rstemp.eof then pRateReview = rstemp("sumStars")/rstemp("countReviews") else pRateReview=0 end if if pRateReview>0 then%>
<%= dictLanguage.Item(Session("language")&"_viewitem_20") & round(pRateReview,2)%> <% else ' >0 %>
<%= dictLanguage.Item(Session("language")&"_viewitem_21")%>

<%end if ' >0 else%> <%if pStoreFrontDemoMode="-1" then%>

"><%=dictLanguage.Item(Session("language")&"_viewitem_9")%> - "><%= dictLanguage.Item(Session("language")&"_viewitem_8")%> <%end if%> <%end if ' reviews%> <% ' check if the item can be personalized and let the customer enter the text if pHasPersonalization=-1 then%>
<%=Server.UrlEncode(dictLanguage.Item(Session("language")&"_viewitem_27"))%> <%end if%>

 
<%call getOptionsGroups(pIdProduct)%> <% ' check if the product has getOneFree mySQL="SELECT idProductFree, description FROM getFreeProduct, products WHERE getFreeProduct.idProduct="&pIdProduct&" and products.idProduct=getFreeProduct.idProductFree" call getFromDatabase (mySql, rsTemp, "viewItem") if not rstemp.eof then%>
(!) <%=dictLanguage.Item(Session("language")&"_viewitem_28")%> <%=rstemp("description")%>
<%end if%> <%if pNoStockAvoidAdding="-1" and pStock<1 then%> <%=dictLanguage.Item(Session("language")&"_viewitem_23")%> <%else%>
/viewitem_addcart.gif" type=image name="add" border="0"> <%end if%> <%if pDiscountPerQuantity=-1 then%>
<%= dictLanguage.Item(Session("language")&"_viewitem_16")%>
<%end if%> <%if pAuctionAvailable=-1 then%>
<%= dictLanguage.Item(Session("language")&"_viewitem_17")%> <%= dictLanguage.Item(Session("language")&"_viewitem_18")%>
<%end if%> <%if pStoreFrontDemoMode="-1" and pEmailToFriend="0" then%>
"><%= dictLanguage.Item(Session("language")&"_viewitem_14")%> <%elseIf pEmailToFriend="-1" then%>
"><%= dictLanguage.Item(Session("language")&"_viewitem_14")%> <%end if%> <%if pWishList="-1" then%>
<%=dictLanguage.Item(Session("language")&"_viewitem_12")%> <%end if%> <%if pStoreFrontDemoMode="-1" and pRelatedProducts="0" then%>
"><%= dictLanguage.Item(Session("language")&"_viewitem_22")%> <%elseIf pRelatedProducts="-1" then%> <%end if%>
 

<% call closeDb() set pIdproduct = Nothing set pDescription = Nothing set pDetails = Nothing set pListPrice = Nothing set pImageUrl = Nothing set pWeight = Nothing ' ****************************** get Optionals ' new get Optionals Function getOptionsGroups(idProduct) dim rstemp2, rstemp3, optionsGroupsCounter optionsGroupsCounter=0 ' get optionsGroups assigned mySQL="SELECT optionsGroups_products.idOptionGroup FROM products, optionsGroups_products WHERE products.idProduct=" &idProduct &" AND products.idProduct=optionsGroups_products.idProduct" call getFromDatabase (mySql, rsTemp2, "ViewItem") ' iterate through optionsGroups do while not rstemp2.eof pIdOptionGroup=rstemp2("idOptionGroup") ' get options inside current optionGroup mySQL="SELECT options.priceToAdd, options.optionDescrip, options.idOption, optionsGroups.optionGroupDesc FROM optionsGroups, options_optionsGroups, options WHERE optionsGroups.idOptionGroup=" &pIdOptionGroup& " AND optionsGroups.idOptionGroup=options_optionsGroups.idOptionGroup AND options.idOption=options_optionsGroups.idOption" call getFromDatabase (mySql, rsTemp3, "ViewItem") if not rstemp3.eof then optionsGroupsCounter=optionsGroupsCounter+1 response.write "
" end if rstemp2.movenext loop response.write "" end function %>