ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Customizing ProductCart
  New Posts New Posts RSS Feed - displaying featured items on an html page
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

displaying featured items on an html page

 Post Reply Post Reply
Author
Message
mrondael View Drop Down
Newbie
Newbie


Joined: 03-May-2007
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote mrondael Quote  Post ReplyReply Direct Link To This Post Topic: displaying featured items on an html page
    Posted: 13-July-2007 at 3:39pm

Hello:

I modified Dan Tang's code snippet so that it displays horizontally, but I'd like to be able to display in a column/row format, say 4 wide by 8 rows or any configuration.

here is the code...

<%
'This file is a modified version of code submitted to the ProductCart Developer's Corner by Dan Tang - sales@dmn.com.au
'To submit your custom ProductCart code to Early Impact, e-mail us at marketing@earlyimpact.com and we will be happy to feature the code on the ProductCart developers' corner located at http://www.earlyimpact.com/productcart/support/developers.as p
%>
<% response.Buffer=true %>
<!--#include file="../includes/settings.asp"-->
<!--#include file="../includes/storeconstants.asp"-->
<!--#include file="../includes/opendb.asp"-->
<!--#include file="../includes/languages.asp"-->
<!--#include file="../includes/currencyformatinc.asp"-->
<%
function preparemsg(what)
 a=what
 a=replace(a,"\","\\")
 a=replace(a,"/","\/")
 a=replace(a,vbclrf,"\n")
 a=replace(a,chr(34),"\"&chr(34))
 a=replace(a,"'","\'")
 a="document.write('"&a&"');"
 preparemsg=a
end function

on error resume next
'Check to see if store has been turned off by admin, then display message
Dim mySQL, conntemp, rs
call openDb()

'select products that are flagged as featured items for the homepage
mySQL="SELECT sku,idProduct, description, serviceSpec, details, price, smallImageUrl FROM products WHERE showInHome=-1 AND active=-1"

set rs=conntemp.execute(mySQL)

if err.number <> 0 then
 call closeDb()
   Response.Write "No featured product available"
 response.end
end if

if rs.eof then
 call closeDb()
   Response.Write "No featured product available"
 response.end
end if
Dim iAddDefaultPrice
DIM Html
i=0
Html=""

URL="/ProductCart/Pc/" 'edit path to the PC folder as needed
do while not rs.eof and i<8  'change this number to return a different amount
 iAddDefaultPrice=rs("price")
  if rs("serviceSpec") then
  mySQL="SELECT categories.categoryDesc, products.description, configSpec_products.configProductCategory, configSpec_products.price, configSpec_products.Wprice, categories_products.idCategory, categories_products.idProduct, products.weight FROM categories, products, categories_products INNER JOIN configSpec_products ON categories_products.idCategory=configSpec_products.configPro ductCategory WHERE (((configSpec_products.specProduct)="&rs("idProduct")&am p;") AND ((configSpec_products.configProduct)=[categories_products].[idproduct]) AND ((categories_products.idCategory)=[categories].[idcategory]) AND ((categories_products.idProduct)=[products].[idproduct]) AND ((configSpec_products.cdefault)=1)) ORDER BY configSpec_products.catSort, categories.idCategory, configSpec_products.prdSort;"
  set rsSSObj=conntemp.execute(mySQL)
  if NOT rsSSobj.eof then
   do until rsSSobj.eof
    iAddDefaultPrice=Cdbl(iAddDefaultPri ce+Cdbl(rsSSobj("price")))
   rsSSobj.moveNext
   loop
   set rsSSobj=nothing
  end if
 end if
 Html=Html & "<td width=25 rowspan=2 align=center><a href=""" & URL & "viewprd.asp?idproduct=" & rs("idProduct") & """><img align=left border=0 width=50  src=" & URL & "Catalog/" & rs("smallImageUrl") & "></a></td><td align=left><font face=""" & FFType & """ color=""" & FColor & """ size=""1""><a href=""" & URL & "viewprd.asp?idproduct=" & rs("idProduct") & """>" & rs("sku") & "</a></font><br><font face=""" & FFType & """ color=""" & FColor & """ size=""2"">"  & rs("Description") & "</font></td>"
 If rs("SmallImageUrl")<>"no_image.gif" and Trim(rs("SmallImageUrl"))<>"" then
  Html=Html & "<td><font face=""" & FFType & """ color=""" & FColor & """ size=""2""><b>" & FormatCurrency(iAddDefaultPrice) & "</b></font><br>&nbsp;</td>"
 Else
  Html=Html & "<td colspan=2><font face=""" & FFType & """ color=""" & FColor & """ size=""2"">"  & rs("Description") & "</font><br>&nbsp;</td>"
 End If
 i=i+1
 rs.movenext
loop

call closeDb()
html= "<table border=0 cellpadding=2 cellspacing=0>" & "<tr>" & Html & "</tr>" &  "<tr><td colspan=2 align=right><font face=""" & FFType & """ color=""" & FColor & """ size=""2""><a href=""" & URL & "ViewSpc.asp"">Store Specials...</a></font></td></tr>< /table>"
response.ContentType="application/x-javascript"
response.write preparemsg(Html)
response.end
%>

Thanks for any help in advance!

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.084 seconds.