[%# $Id$ %]
[% USE hcart = Handel.Cart %]
<body>
[% IF (cart = hcart.create({
description => 'My New Shopping Cart',
id => '6509982B-14B3-4AB0-8DEB-B5160B115521',
name => 'New Cart',
shopper => 'BEF1EC2E-DA24-42B3-907A-F1EA796E13E9',
type => hcart.CART_TYPE_TEMP
})) %]
[% CALL cart.add({
description => 'Description 1',
id => 'E766EAC7-CB67-4BFC-A54F-592B1F029363',
price => 1.11,
quantity => 1,
sku => 'SKU1'
}) %]
[% CALL cart.add({
description => 'Description 2',
id => 'AC156B65-0779-4D96-AE72-CAB2E981F34E',
price => 2.22,
quantity => 2,
sku => 'SKU2'
}) %]
[% ELSE %]
<message>Error creating shopping cart</message>
[% END %]
[% IF (cart = hcart.search({
type => hcart.CART_TYPE_TEMP,
id => '6509982B-14B3-4AB0-8DEB-B5160B115521'
}).first) %]
<cart>
<count>[% cart.count %]</count>
<description>[% cart.description %]</description>
<id>[% cart.id %]</id>
<name>[% cart.name %]</name>
<shopper>[% cart.shopper %]</shopper>
<subtotal>[% cart.subtotal.value %]</subtotal>
<type>[% cart.type %]</type>
[% FOREACH item = cart.items.all %]
<item>
<description>[% item.description %]</description>
<id>[% item.id %]</id>
<price>[% item.price.value %]</price>
<quantity>[% item.quantity %]</quantity>
<sku>[% item.sku %]</sku>
<total>[% item.total.value %]</total>
</item>
[% CALL item.description('My Updated Item') %]
[% CALL item.price(10.13) %]
[% CALL item.quantity(22) %]
[% CALL item.sku('UPDATED123') %]
<updateditem>
<description>[% item.description %]</description>
<id>[% item.id %]</id>
<price>[% item.price.value %]</price>
<quantity>[% item.quantity %]</quantity>
<sku>[% item.sku %]</sku>
<total>[% item.total.value %]</total>
</updateditem>
[% END %]
<subtotal>[% cart.subtotal.value %]</subtotal>
</cart>
[% ELSE %]
<message>Could not find cart</message>
[% END %]
</body>