{{assign var=CartCollection				value=133}}
{{assign var=ShippingCollection			value=139}}
{{assign var=CartDetailsCollection		value=134}}
{{assign var=TaxCollection				value=151}}
{{assign var=SessionID   		value=''|sessionid}}
{{getCollectionByCategory CollectionID=$CartCollection Collection_133_1=$SessionID aditionalFilter=' (Collection_133_5<>"on" or Collection_133_5 IS NULL) ' var=CartData OrderColumn='ID'}}

{{assign var=CartDataItem value=$CartData[0]}}
{{assign var=CartID value=$CartDataItem.Collection_133_ID}}
{{assign var=CouponID value=$CartDataItem.Collection_133_16}}
{{assign var=CouponDiscountValue value=$CartDataItem.Collection_133_27}}
{{assign var=MethodID value=$CartDataItem.Collection_133_17}}
{{assign var=ChoosenZip value=$CartDataItem.Collection_133_30}}
{{assign var=ChoosenShippingPrice value=$CartDataItem.Collection_133_26}}
{{assign var=PaymentMethodID value=$CartDataItem.Collection_133_19}}
{{assign var=ProductsTotalValue value=$CartDataItem.Collection_133_24}}
{{assign var=CartTotalValue value=$CartDataItem.Collection_133_23}}
{{assign var=CartTaxValue value=$CartDataItem.Collection_133_25}}


{{assign var=CartClosed value=$CartDataItem.Collection_133_28}}
	
{{if $CouponID gt 0}}	
	{{getCollectionByCategory CollectionID=135 ColumnID='ID' Value=$CouponID var=Coupons OrderColumn='ID'}}
	{{assign var=CouponData value=$Coupons[0]}}
	{{assign var=Coupon value=$CouponData.Collection_135_3}}
{{/if}}
	
	
	{{getCollectionByCategory CollectionID=$CartDetailsCollection ColumnID=1 Value=$CartID var=CartDetails OrderColumn='ID'}}
	{{assign var=CartDetailPrefix   	value='Collection_'}}
	{{assign var=CartDetailPrefix   	value=$CartDetailPrefix|concat:$CartDetailsCollection|concat:'_'}}
	{{assign var=CartDetailID 			value=$CartDetailPrefix|concat:'ID'}}
	{{assign var=CartDetailFreeShipping	value=$CartDetailPrefix|concat:'8'}}
	{{assign var=CartDetailName 		value=$CartDetailPrefix|concat:'7'}}
	{{assign var=CartDetailProductID 	value=$CartDetailPrefix|concat:'2'}}
	{{assign var=CartDetailQuantity 	value=$CartDetailPrefix|concat:'3'}}
	{{assign var=CartDetailPriceID 		value=$CartDetailPrefix|concat:'4'}}
	{{assign var=CartDetailPrice 		value=$CartDetailPrefix|concat:'5'}}
	{{assign var=CartDetailPriceDesc 	value=$CartDetailPrefix|concat:'6'}}
	{{assign var=CartDetailTax 	        value=$CartDetailPrefix|concat:'12'}}
	{{assign var=CartDetailOffer 	    value=$CartDetailPrefix|concat:'11'}}
	{{assign var=CartDetailPriceWithDiscount       value=$CartDetailPrefix|concat:'10'}}
	
	
<form name="sh_cart" action="" method="post" id="shcartForm">
	
	{{if $errors neq ''}}
		<div id="carterrors">
			<ul>{{$errors}}</ul>
		</div>
	{{/if}}
	<div id="editcartcontainer">
				<div class="sep"><img src="/images/sep.gif" height="5"/></div>
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td  class="heading"><strong>Item</strong></td>
					<td  class="heading"><strong>Qty.</strong></td>
					<td  class="heading" align="right"><strong>Price</strong></td>
					<td  class="heading"><img src="/images/sep.gif" height="15"/></td>
				</tr>
				{{foreach from=$CartDetails item=v key=k name=clist}}
					
					
					{{if $smarty.foreach.clist.iteration % 2 eq 0}}
						{{assign var=class value='odd'}}
					{{else}}
						{{assign var=class value='even'}}
					{{/if}}
					
					<tr valign="top">
							<td class="item {{$class}}">{{$v.$CartDetailName}} <br/>  {{if $v.$CartDetailOffer neq ''}}<br/>{{$v.$CartDetailOffer}}{{/if}}</td>
							<td class="data {{$class}}" width="50">{{if $CartClosed neq 'on'}}<input type="text" size="2" value="{{$v.$CartDetailQuantity}}" id="q_{{$v.$CartDetailID}}" name="q_{{$v.$CartDetailID}}" class="input"/> <img src="/images/update.gif" class="updateicon" title="Update Cart"/> {{else}}{{$v.$CartDetailQuantity}}{{/if}}</td>
							<td class="data {{$class}}" align="right">${{$v.$CartDetailPriceWithDiscount|string_format:'%.2f'}}{{if $v.$CartDetailPriceWithDiscount neq $v.$CartDetailPrice}}<br/>(Regular Price: ${{$v.$CartDetailPrice|string_format:'%.2f'}}){{/if}}<br/>
							{{if $CartClosed neq 'on'}}
									<a href="javascript://" id="remove{{$v.$CartDetailID}}">Remove</a>
									{{capture name=nozip assign=needhelp}}
									$('#remove{{$v.$CartDetailID}}').click(function(){ $('#q_{{$v.$CartDetailID}}').val('0'); $('#shcartForm').submit(); });
									
									{{/capture}}
								{{assign var=JavaScriptJQueryCode value=$JavaScriptJQueryCode|concat:' '|concat:$needhelp}}
							{{/if}}
							</td>
							<td class="{{$class}}"><img src="/images/sep.gif" height="15"/></td>
					</tr>
				{{/foreach}}
					</table>
		</div>			
		<div class="totals right"><strong>Total: ${{$ProductsTotalValue|string_format:'%.2f'}}</strong></div>
		
		<div id="cartdetailscontainer">
					<table cellpadding="0" cellspacing="0" border="0">
					<tr valign="top">
						<td>Payment Method:</td>
						{{getCollectionByCategory CollectionID=147 ColumnID='2' Value='on' var=PaymentMethods OrderColumn='ID'}}
						<td>
						
						{{if $PaymentMethods|@count gt 1}}
								
								
									{{foreach from=$PaymentMethods item=v key=k}}
										<input type="radio" name="paymentmethod" {{if $v.Collection_147_ID eq $MethodID}} checked{{/if}} value="{{$v.Collection_147_ID}}"/> {{$v.Collection_147_1}}<br/>
									{{/foreach}}
								
								{{else}}
								{{assign var=PaymentMethod	value=$PaymentMethods[0]}}
								<input type="hidden" name="paymentmethod" value="{{$PaymentMethod.Collection_147_ID}}"/> {{$PaymentMethod.Collection_147_1}}
								{{/if}}
						
						</td>
					</tr>
					<tr valign="top">
						<td>Discount Code:</td>
						<td><input type="text" size="28" name="coupon" class="input" value="{{$Coupon}}"/></td>
					</tr>
					<tr valign="top">
						<td>ZIP Code (to calculate tax):</td>
						<td><input type="text" class="input" value="{{$ChoosenZip}}" name="zipcode" id="zipcodeshipping"/></td>
					</tr>
					<tr>
						<td colspan="2">
						<input type="submit" name="startcalculate" id="startcalculate" value="Update Cart" />
						{{if $smarty.get.page neq ''}}
			    			<p><a href="{{$smarty.get.page}}">Continue Shopping</a></p>
						{{else}}
							<p><a href="/store/">Continue Shopping</a></p>
			    		{{/if}}  
						</td>
					</tr>
					</table>
		
		</div>
		
		<div id="cartsummary">
					<table cellpadding="0" cellspacing="0" border="0">
					<tr valign="top">
						<td class="text">Merchandise Value</td>
						<td class="value">${{$ProductsTotalValue|string_format:'%.2f'}}</td>
					</tr>
					<tr valign="top">
						<td class="text">Shipping Value</td>
						<td class="value">${{$ChoosenShippingPrice|string_format:'%.2f'}}</td>
					</tr>
					<tr valign="top">
						<td class="text">Tax Value</td>
						<td class="value">${{$CartTaxValue|string_format:'%.2f'}}</td>
					</tr>
					{{if $Coupon neq ''}}
					<tr>
						<td class="text"><strong>Coupon Code:</strong></td>
						<td class="value">{{$Coupon}}</td>
					</tr>
					<tr>
						<td colspan="2">{{$CouponData.Collection_135_7}}</td>
					</tr>
					<tr>
						<td class="text"><strong>Coupon Discount Value:</strong></td>
						<td class="value">${{$CouponDiscountValue|string_format:'%.2f'}}</td>
					</tr>
					{{/if}}
					<tr>
						<td class="totals"><strong>Grand Total:</strong></td>
						<td class="totals">${{$CartTotalValue|string_format:'%.2f'}}</td>
					</tr>
					
					</table>
		
		</div>										
		
		<div id="cartcheckout">
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr valign="middle">
					<td class="column" align="center" width="50%">
						<p>Need Help?</p>
						<p><a href="javascript://" class="needhelp">Click here!</a></p>
					</td>
					<td class="column" align="center">
						<input type="submit" name="checkout" id="startcalculate" value="Checkout" />
					</td>
				</tr>
				</table>
		
		</div>			
					
					 
										
				<div id="needhelp" style="display:none ">{{getcontent id=141}}</div>
				{{capture name=nozip assign=needhelp}}
					$('.needhelp').click(function(){

							var tmpHtml = $('#needhelp').html();
							$(this).o2dialog( {
									width: 300, 
									height: 60 ,
									title: 'Need Help?',
									content: '<br/>'+tmpHtml ,
									onUnLoad: function(){
										$('#needhelpdialog').remove();
									}
							});
					
					});
					
					$('.updateicon').click(function(){
									$('#shcartForm').submit();						
							}).css('cursor','pointer');
					
				{{/capture}}
				{{assign var=JavaScriptJQueryCode value=$JavaScriptJQueryCode|concat:' '|concat:$needhelp}}
				
				
	
	
	
				
				
			

</form>