## ## 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. ## Commit Purchases Transaction

Commit Purchases Transaction

When the user confirms their purchases the confirmation must be reflected in the database by updating the status of the order. The transaction as a whole must then be committed and signaled to the home page so that, if the user returns to the home page, they can start afresh with a new order number. Then we display the contents of the order, the cost, and the order number for reference.

File: play_shopConfirm.html

<html>
<head>
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK HREF="<!-- #ICE INCLUDE=`plays[play_styleSheet.css]` -->" TYPE="text/css" REL="STYLESHEET">
<title>Order Confirmed</title>
</head>
<body>
<h1>Order Nr: <!-- #ICE VAR=`:e_orderNumber` --> Confirmed</h1>

<!-- #ICE 
    DATABASE=`icetutor`
    SQL=`update play_order
    set status = 2
    where order_nr = :e_orderNumber 
    and user_id = ':ii_userid'`
    TRANSACTION=`t_shopAdd`
-->
<!-- Commit the transaction -->
<!-- #ICE COMMIT=`t_shopAdd` -->
<!-- Set the transaction to 'complete' as it is now committed -->
<!-- #ICE DECLARE=`session.e_shopTxn=COMPLETE` -->

<!-- Show the products ordered: -->
<p>
You have ordered the following:
<br>
<!-- #ICE 
    DATABASE=`icetutor`
    SQL=`set lockmode session where readlock = nolock;
	select name, cost
	from play_item, play_order
	where id = product_id and
            (order_nr = :e_orderNumber and user_id = ':ii_userid')`
    TYPE=`TABLE`
-->

<!-- Show the total cost: -->
<p>
The total value of your order is:
<br>
<!-- #ICE 
    DATABASE=`icetutor`
    SQL=`set lockmode session where readlock = nolock;
         select sum(cost)
	    from play_item
	    where id = 
		    (select product_id from play_order
		    where order_nr = :e_orderNumber 
		    and user_id = ':ii_userid')`
    TRANSACTION=`t_shopConfirmList`
    HEADERS=`col1, Total`
    TYPE=`TABLE`
-->
<!-- Commit the transaction -->
<!-- #ICE COMMIT=`t_shopConfirmList` -->
<p>
<!-- #ICE VAR=`Your order number <b>:e_orderNumber</b> will now be processed.<br>
Please quote this number in all correspondence` -->
<p>
We suggest that you print this page for your
records,
<p>
Thank you for your custom,
<br>
<i>Your Globe Heritage Team</i>
<!-- #ICE REPEAT INCLUDE=`plays[play_shopAction_h.html]` -->
<!-- Standard Session Control -->
<!-- #ICE REPEAT INCLUDE=`plays[play_SessionControl_h.html]` -->
</body>
</html>

When the status of the order has been updated in the play_order table, we commit the transaction, and then update the value of the session variable, e_shopTxn to 'COMPLETE'.

<!-- #ICE DECLARE=`session.e_shopTxn=COMPLETE` -->

This will cause the code in the shop home page to issue a new order number should the user return there.

If the user decides not to continue with their order they will proceed to empty the contents of their bag.