[%# $Id$ %] [% META title='Shopping Cart' %] [% INCLUDE header.tt2 %] [% USE CGI %] [% USE Handel.Cart %] [% shopper = CGI.cookie('shopper') %] [% UNLESS shopper %] [% shopper = Handel.Cart.uuid %] [% cookie = CGI.cookie('-name', 'shopper', '-value', shopper, '-expires', '+1y') %] [% CGI.header('-cookie', cookie) %] [% END %] [% UNLESS Handel.Cart.search({shopper => shopper, type => 0}).count %] [% UNLESS Handel.Cart.create({shopper => shopper}) %]

Could not create new shopping cart.

[% END %] [% END %] [% FOREACH cart IN Handel.Cart.search({shopper => shopper, type => 0}).first %] [% IF CGI.param('action') == 'add' %] [% CALL cart.add( sku=CGI.param('sku'), description=CGI.param('description'), price=CGI.param('price'), quantity=CGI.param('quantity') ) %] [% ELSIF CGI.param('action') == 'delete' %] [% CALL cart.delete(id=CGI.param('id')) %] [% ELSIF CGI.param('action') == 'update' %] [% item = cart.items(id=CGI.param('id')).first %] [% IF item %] [% CALL item.quantity(CGI.param('quantity')) %] [% CALL item.update %] [% END %] [% END %] [% IF cart.count > 0 %] [% items = cart.items %] [% WHILE (item = items.next) %] [% END %]
SKU Description Price Quantity Total
[% item.sku %] [% item.description %] [% item.price %]
[% item.total %]
Subtotal [% cart.subtotal %]
[% ELSE %]

Your shopping cart is empty.

[% END %] [% END %] [% INCLUDE footer.tt2 %]