home *** CD-ROM | disk | FTP | other *** search
- <!--- This template is used by other templates via CFINCLUDE; for
- example, after additem.cfm is used to add an item to the shopping
- cart, _showcart.cfm is CFINCLUDE-ed to show the result contents
- of the shopping cart. --->
-
- <!--- Don't let the browser cache this page. Otherwise we might
- be looking at a cached shopping cart which does not reflect
- what is truly in the cart. --->
- <CFHEADER Name="Expires" Value="#Now()#">
- <CFHEADER NAME="pragma" VALUE="no-cache">
-
- <!--- If there are 0 of any item, remove that item from the cart --->
- <CFSET LoopVar = 1>
- <CFLOOP CONDITION="LoopVar LTE ListLen(Session.StoreItems)">
- <CFIF ListGetAt(Session.StoreQuantities, LoopVar) LT 1>
- <CFSET Session.StoreQuantities = ListDeleteAt(Session.StoreQuantities, LoopVar)>
- <CFSET Session.StoreItems = ListDeleteAt(Session.StoreItems, LoopVar)>
- <CFELSE>
- <CFSET LoopVar = LoopVar + 1>
- </CFIF>
- </CFLOOP>
-
-
- <FONT FACE=" arial black,Helvetica bold,geneva,helvetica" SIZE="7" COLOR="##000000"><I>Bag It!</i></FONT><br>
- <br>
-
- <TABLE BORDER="0" CELLPADDING="5" CELLSPACING="1" bgcolor="000000">
-
- <!--- These are just the column headings --->
- <TR>
- <TD BGCOLOR="#660000"><FONT FACE="Helvetica" SIZE="-1" COLOR="#FFFF00"><B>Item #</B></TD>
- <TD BGCOLOR="#660000"><FONT FACE="Helvetica" SIZE="-1" COLOR="#FFFF00"><B>Description</B></TD>
- <TD BGCOLOR="#660000"><FONT FACE="Helvetica" SIZE="-1" COLOR="#FFFF00"><B>Unit Price</B></TD>
- <TD BGCOLOR="#660000"><FONT FACE="Helvetica" SIZE="-1" COLOR="#FFFF00"><B>Quantity</B></TD>
- <TD BGCOLOR="#660000"><FONT FACE="Helvetica" SIZE="-1" COLOR="#FFFF00"><B>Subtotal</B></TD>
- </TR>
-
-
- <!--- If the shopping cart is empty, just say that. --->
- <CFIF Session.StoreItems IS "">
-
- <TR>
- <TD BGCOLOR="#FFcc66" COLSPAN="5" ALIGN="CENTER">
- <FONT FACE="Helvetica" SIZE="-1"><I>(There are currently no items in your
- shopping cart.)</I></FONT>
- </TD>
- </TR>
-
- <!--- On the other hand, if the cart is not empty... --->
- <CFELSE>
-
- <!--- This form is called if quantities of the items are changed --->
- <FORM ACTION="changequants.cfm" METHOD="POST">
- <CFOUTPUT>
- <INPUT TYPE="HIDDEN" NAME="StoreItems" VALUE="#Session.StoreItems#">
- <INPUT TYPE="HIDDEN" NAME="StoreQuantities" VALUE="#Session.StoreQuantities#">
- </CFOUTPUT>
-
- <!--- This variable will be used to accumulate the total cost --->
- <CFSET TotalCost = 0>
-
- <!--- Loop over the list of items in the shopping cart --->
- <CFLOOP LIST="#Session.StoreItems#" INDEX="CurrentItemID">
-
- <!--- Find the quantity of each item --->
- <CFSET ItemPosition = ListFind(Session.StoreItems, CurrentItemID)>
- <CFSET Quantity = ListGetAt(Session.StoreQuantities, ItemPosition)>
-
- <!--- This query is just to get the name and price of the current
- item so that we can display that data in the table --->
- <CFQUERY DATASOURCE="CFexamples" NAME="GetCurrentItem">
- SELECT ItemID, PartNum, ItemName, ItemPrice FROM StoreItems
- WHERE ItemID = #CurrentItemID#
- </CFQUERY>
-
- <!--- Now display the data for the current item --->
- <CFOUTPUT QUERY="GetCurrentItem">
- <TR>
- <TD BGCOLOR="##FFff99"><FONT FACE="Helvetica" SIZE="-1">#PartNum#</TD>
- <TD BGCOLOR="##FFff99"><FONT FACE="Helvetica" SIZE="-1">#ItemName#</TD>
- <TD BGCOLOR="##FFff99"><FONT FACE="Helvetica" SIZE="-1">#DollarFormat(ItemPrice)#</TD>
- <TD BGCOLOR="##FFff99"><FONT FACE="Helvetica">
- <INPUT TYPE="TEXT" NAME="Item#ItemID#" SIZE="3" VALUE="#Variables.Quantity#">
- </TD>
- <TD BGCOLOR="##FFff99" ALIGN="RIGHT"><FONT FACE="Helvetica" SIZE="-1">
- #DollarFormat(ItemPrice * Variables.Quantity)#
- </TD>
- </TR>
- </CFOUTPUT>
-
- <!--- Add cost of current item(s) to total cost --->
- <CFSET TotalCost = TotalCost + GetCurrentItem.ItemPrice * Variables.Quantity>
-
- </CFLOOP>
-
- <TR>
- <TD COLSPAN="4" BGCOLOR="#FFff99" ALIGN="RIGHT">
- <FONT FACE="Helvetica" SIZE="-1"><B>Total</B></FONT>
- </TD>
- <TD BGCOLOR="#FFff99" ALIGN="RIGHT">
- <!--- Display the total cost --->
- <CFOUTPUT>
- <FONT FACE="Helvetica" SIZE="-1">#DollarFormat(TotalCost)#</FONT>
- </CFOUTPUT>
- </TD>
- </TR>
- </TABLE>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=382>
- <TR>
- <TD><BR><INPUT TYPE="SUBMIT" VALUE="Change Quantities"></TD>
- <TD ALIGN="RIGHT"><BR><INPUT TYPE="BUTTON" VALUE="Checkout" onClick="location.href = 'checkout.cfm'"></TD>
- </TR>
-
- </FORM>
-
- </CFIF>
-
- </TABLE>
-
- <BR>
-
- <FONT FACE="Helvetica" SIZE="-1">
- <CFOUTPUT>
- <A HREF="showcategories.cfm">Return to Category Listing</A><BR>
- <CFIF IsDefined("Session.LastCategory")><A HREF="showitems.cfm?CategoryID=#Session.LastCategory#">Return to Last Category</A></CFIF>
- </CFOUTPUT>
- </FONT>