1{tikimodule error=$module_params.error title=$tpl_module_title name="cart" flip=$module_params.flip decorations=$module_params.decorations nobox=$module_params.nobox notitle=$module_params.notitle}
2{if !empty($cart_content)}
3	{if $module_params.showItems neq 'n'}
4		<form method="post" action="{if $module_params.ajax eq 'n'}{query _keepall='y' _type='relative'}{else}{service controller='module' action='execute'}{/if}"{if $module_params.ajax eq 'y'} class="mod-cart-form"{/if}>
5		<table>
6			<tr>
7				<th>{tr}Product{/tr}</th>
8				<th style="width:5em;">{tr}Unit cost{/tr}</th>
9				<th{if $module_params.showItemButtons eq 'n'} style="width:2em;"{/if}>{tr}Qty{/tr}</th>
10			</tr>
11
12			{foreach from=$cart_content item=item}
13					<tr>
14						<td>
15							{if $item.href}
16								<a href="{$item.href|escape}">
17									{$item.description|escape}
18								</a>
19							{else}
20								{$item.description|escape}
21							{/if}
22							{if $item.onbehalf}
23								{tr}for{/tr} {$item.onbehalf|escape|truncate:16}
24							{/if}
25						</td>
26						<td style="width:5em;" align="right">
27							{$item.price|escape}
28						</td>
29						{if $module_params.showItemButtons eq 'n'}
30							<td style="width:2em;">
31								<input type="text" name="cart[{$item.code|escape}]" style="width:2em;text-align:right;" value="{$item.quantity|escape}">
32							</td>
33						{else}
34							<td style="white-space: nowrap">
35								<a href="#" onclick="$(this).nextAll('input').val('').parents('form:first').submit();return false;" class="icon item_remove">{icon name='trash'}</a>
36								<a href="#" onclick="var $input = $(this).nextAll('input:first');$input.val(parseInt($input.val()) + 1).parents('form:first').submit();return false;" class="icon item_plus">{icon name='add'}</a>
37								<input type="text" name="cart[{$item.code|escape}]" style="width:2em;text-align: right;" value="{$item.quantity|escape}">
38								<a href="'#" class='icon item_minus' onclick="var $input = $(this).prevAll('input:first');$input.val(parseInt($input.val()) - 1).parents('form:first').submit();return false;">{icon name='minus'}</a>
39							</td>
40							{if $module_params.ajax eq 'n'}<input type="hidden" name="update" value="1">{/if}
41						{/if}
42					</tr>
43					{foreach from=$item.bundledproducts item=child_item}
44						<tr>
45							<td colspan="3">
46								{tr}Bundled Product{/tr} - {$child_item.description|escape} {if $child_item.quantity > 1}(x{$child_item.quantity|escape}){/if}
47							</td>
48							<td style="width:5em;" align="right">
49								{$item.price|escape}
50							</td>
51							<td style="width:2em;">
52								<input type="text" name="cart[{$item.code|escape}]" style="width:2em;text-align:right;" value="{$item.quantity|escape}">
53							</td>
54						</tr>
55					{/foreach}
56			{/foreach}
57			{if $module_params.ajax eq 'n'}<tr>
58				<td></td>
59				<td colspan="2" align="right"><input type="submit" class="btn btn-primary btn-sm" name="update" value="{tr}Update{/tr}"></td>
60			</tr>
61			{else}
62				<input type="hidden" name="update" value="1">
63			{/if}
64		</table>
65		</form>
66	{/if}
67	{if $module_params.showCount eq 'y'}
68		<p class="item_count">{tr _0=$cart_count}Cart contains <span>%0</span> items{/tr}</p>
69	{/if}
70	{if not empty($cart_weight)}
71		<p class="cart_weight">{tr _0=$cart_weight _1=$module_params.weightUnit}Total weight %0 %1{/tr}</p>
72		<input type="hidden" name="cart_weight" value="{$cart_weight}">
73	{/if}
74
75	<form method="post" action=""{if $module_params.ajax eq 'y'} class="mod-cart-checkout-form"{$json_data}{/if}>
76		{if $has_gift_certificate}
77			<div class="gift_certificate">
78				{if $gift_certificate_redeem_code && $gift_certificate_amount}
79					<p>
80						{tr}Gift Certificate:{/tr} {$gift_certificate_redeem_code}<br>
81						{tr}Value{/tr}
82						: {$gift_certificate_mode_symbol_before}{$gift_certificate_amount}{$gift_certificate_mode_symbol_after}
83					</p>
84				{/if}
85				{if $gift_certificate_redeem_code}
86					<input type="submit" class="btn btn-warning btn-sm" name="remove_gift_certificate" value="{tr}Remove Gift Certificate{/tr}">
87				{else}
88					Code: <input type="text" name="gift_certificate_redeem_code" style="width: 70px;">
89					<input type="submit" class="btn btn-primary btn-sm" name="add_gift_certificate" value="{tr}Add Gift Certificate{/tr}">
90				{/if}
91			</div>
92		{/if}
93		<p>{tr}Total:{/tr} <strong>{$cart_total|escape} {$prefs.payment_currency|escape}</strong></p>
94
95		<input type="submit" class="btn btn-primary btn-sm" name="checkout" value="{tr}Check-out{/tr}">
96	</form>
97{else}
98	<p>{tr}Your cart is empty{/tr}</p>
99{/if}
100{/tikimodule}
101