## ## Document History ## ## Created (peeje01) ## 27-Apr-1999 (peeje01) ## Change include file name from -h.html to _h.html ## 02-Apr-2004 (fanra01) ## Bug 112091 ## Editorial changes from griel02. ##
The Description page selects the required product, passed in as the HTML variable id, and displays more information about the item (in this case, the price). In addition we also provide a link to add the item to the shopping bag and another to return back to the shop home page. The add item link passes the item id to the confirmation page.
<html>
<head>
<title>Shop Description Page</title>
</head>
<body>
<center>
<h1>Shop Description Page</h1>
</center>
<!-- #ICE REPEAT
DATABASE = `icetutor`
SQL=`select id, name, cost from play_item where id = :id`
TYPE=`UNFORMATTED`
HTML=`<p>You have selected:<br>
<b>:name</b>
@ :cost Silver Crown<!-- #ICE IF ( ``1`` != ``:cost``)
THEN=``s`` -->
<br>
<a href="plays[play_shopAdd.html]?id=:id">Add to Shopping Bag</a>`
-->
<p>
<!-- #ICE VAR=`
<A HREF="/ice-bin/oiice.dll/playgroup/plays[play_shopHome.html]">
Select a new product</A>` -->
<!-- Standard Session Control -->
<!-- #ICE REPEAT INCLUDE=`plays[play_SessionControl_h.html]` -->
</body>
</html>
First, we select the id, name and cost of
the product from the table play_item, specifying
the id in the where clause as passed in with the
HTML variable id, specifying the
UNFORMATTED type as follows:
SQL=`select id, name, cost from play_item where id = :id`
TYPE=`UNFORMATTED`
We need an unformatted output from the select
statement because we wish to add the HTML code to
add this item to the shopping bag, which we do as
follows:
HTML=`<p>You have selected:<br>
<b>:name</b>
@ :cost Silver Crown<!-- #ICE IF ( ``1`` != ``:cost``)
THEN=``s`` -->
<br>
<a href="plays[play_shopAdd.html]?id=:id">Add to Shopping Bag</a>`
The anchor, in the last line, is built up by passing the item identifier held in the HTML variable id to the next document, play_shopAdd.html with the caption "Add to Shopping Bag" (we doubt that shopping carts existed in Elizabethian England).
For the final touch, we test to see if the cost of the item is one Silver Crown, if it is not then we pluralize the word Crown thus resulting in 'Crown' or 'Crowns' as required.
The following page examines the code necessary to add the item to the shopping bag.