home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 139 / dpcs0999.iso / Web / CFserver / data1.cab / Examples / store / showitems.cfm < prev    next >
Encoding:
Text File  |  1999-04-12  |  2.4 KB  |  90 lines

  1. <!--- If no category is currently selected, go to the category
  2.       selection page --->
  3. <CFIF NOT IsDefined("CategoryID")>
  4.     <CFLOCATION URL="showcategories.cfm">
  5. </CFIF>
  6.  
  7. <!--- This CFQUERY retrieves the name of the current category --->
  8. <CFQUERY DATASOURCE="CFexamples" NAME="GetCurrentCategory">
  9.     SELECT CategoryName FROM StoreCategories
  10.     WHERE CategoryID = #CategoryID#
  11. </CFQUERY>
  12.  
  13. <!--- This CFQUERY retrieves the items that belong
  14.       to the current category --->
  15. <CFQUERY DATASOURCE="CFexamples" NAME="GetItems">
  16.     SELECT StoreItems.*, StoreManufacturers.Name
  17.     FROM StoreItems, StoreManufacturers
  18.     WHERE StoreItems.ManufacturerID = StoreManufacturers.ManufacturerID
  19.         AND CategoryID = #CategoryID#
  20. </CFQUERY>
  21.  
  22. <!--- Set this for later --->
  23. <CFSET Session.LastCategory = CategoryID>
  24.  
  25. <HTML>
  26. <HEAD>
  27. <TITLE>Online Store - Browse Items</TITLE>
  28. </HEAD>
  29.  
  30. <BODY BGCOLOR="#FFCC00" LINK="Maroon" background="images/storebg.gif" leftmargin=5 topmargin=0>
  31.  
  32.  
  33. <SPAN STYLE="position: absolute; left: 205px; top: 10px; width: 350px">
  34. <CFOUTPUT><FONT FACE="Arial Black, Helvetica Bold, Geneva, Helvetica" SIZE="7" COLOR="##000000"><I>#GetCurrentCategory.CategoryName#</I></FONT></CFOUTPUT>
  35. <BR><BR>
  36. <TABLE BORDER="0" CELLPADDING="5" CELLSPACING="0" WIDTH="350">
  37.  
  38.     <!--- This CFOUTPUT block loops over the GetCategories query
  39.           and creates the following HTML for each one. --->
  40.     <CFOUTPUT QUERY="GetItems">
  41.  
  42.         <FORM ACTION="additem.cfm" METHOD="POST">
  43.  
  44.             <INPUT TYPE="HIDDEN" NAME="ItemID" VALUE="#ItemID#">
  45.  
  46.             <TR>
  47.                 <TD><FONT FACE="Helvetica" SIZE="-1" COLOR="##000000"><B>#ItemName#</B></FONT></TD>
  48.                 <TD ALIGN="RIGHT">
  49.                 <FONT FACE="Helvetica" SIZE="-1" COLOR="##000000">#DollarFormat(ItemPrice)#</FONT>
  50.                 </TD>
  51.             </TR>
  52.  
  53.             <TR>
  54.                 <TD COLSPAN="2">
  55.                     <FONT FACE="Helvetica" SIZE="-1">#ItemDesc#<BR><BR>
  56.                     <B>Manufacturer:</B> #Name#<BR>
  57.                     <B>Part Number:</B> #PartNum#</FONT>
  58.                 </TD>
  59.             </TR>
  60.  
  61.             <TR>
  62.                 <TD COLSPAN="2" ALIGN="RIGHT"><FONT FACE="Helvetica" SIZE="-1">
  63.                 <INPUT TYPE="SUBMIT" VALUE="Add to Cart"></FONT></TD>
  64.             </TR>
  65.  
  66.             <TR>
  67.                 <TD COLSPAN="2" HEIGHT="50"></TD>
  68.             </TR>
  69.  
  70.         </FORM>
  71.     
  72.     </CFOUTPUT>
  73. </TABLE>
  74.  
  75. <FONT FACE="Helvetica" SIZE="-1">
  76.     <A HREF="showcategories.cfm">Return to Categories</A>
  77. </FONT>
  78. <CF_ShowDoc ID=2>
  79. <BR><BR>
  80.     </TD>
  81. </TR>
  82. </TABLE>
  83.  
  84. </SPAN>
  85.  
  86. <CFINCLUDE TEMPLATE="_showcart.cfm">
  87.  
  88. </BODY>
  89. </HTML>
  90.