The cart's contents is stored in a session object. A user's cart contents will be lost when their session ends (eg when they close their browser). When the "Checkout >>" button is clicked on the cart screen, the contents of the cart Session object are transferred to the database. A wtOrder node is created and its child 'wtOrderItem' nodes are the contents of the cart. The wtOrder nodes can be found in node browser under /Orders. When the wtOrder node is first created its status will be set to blank and Paid will be set to 'No'. Only wtOrders with non blank statuses will show in the orders reporting in the office.
The following HTML form will add a product to the cart session object and redirect to the cart after the product is added ([wt:__guid] should be substituted with the product's guid):
<form method="post" action="">
<input type="hidden" name="wtCmd" value="cartset"/>
<input type="hidden" name="wtRedirectTo" value="[wt:wt.site.base]cart?path=[wt:wt.page]"/>
<input name="productquantity_[wt:__guid]" type="hidden" value="1" class="qty" />
<input type="submit" value="Add to Cart" class="formbutton" />
</form>
The <wt:cart/> tag will display the cart contents and the "Checkout >>" submit button. Submitting the checkout form with the "Checkout >>" button will instruct WebTemplate to transfer the Carts contents to the database and then redirect to the "Site Details/Site Secure URL". The following form will have the same action as the "Checkout >>" button
<form method="post"> <input name="wtCmd" value="cartupdate" type="hidden"> <input class="formbutton" name="cartaction" value="Checkout >>" type="submit"> </form>
Usually a page with the URI 'cart' will be created under 'Special Pages' in Site Builder. The 'cart' page typically uses the 'Cart' template which should contain the <wt:cart/> tag.
An example cart template:
<wt:setting name="index" value="no"/>
<wt:if test="[wt:wt.request.wtStep]">
<div id="wtCartSteps">
<ul>
<li class="step1<wt:if test="[wt:wt.request.wtStep] == 'billingdetails' || [wt:wt.request.wtStep] == 'deliverydetails'"> onStep</wt:if><wt:if test="[wt:wt.request.wtStep] == 'summary' || [wt:wt.request.wtStep] == 'successful'"> pastStep</wt:if>">Enter your Details</li>
<li class="step2<wt:if test="[wt:wt.request.wtStep] == 'summary'"> onStep</wt:if><wt:if test="[wt:wt.request.wtStep] ==
'successful'"> pastStep</wt:if>">Payment Details</li>
<li class="step3<wt:if test="[wt:wt.request.wtStep] == 'successful'"> onStep</wt:if>">Order Summary</li>
</ul>
</div><!-- cart steps -->
</wt:if>
<div id="cartHolder"><wt:cart/></div><!-- cart holder -->