{{assign var=CartCollection value=133}}
{{assign var=CartDetailsCollection value=134}}
{{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}}
{{getCollectionByCategory CollectionID=$CartDetailsCollection ColumnID=1 Value=$CartID var=CartDetails OrderColumn='ID'}}

{{if $smarty.post and $CartDetails|@count gt 0 }}

{{updateCart cartID=$CartID cartData=$CartDataItem cartDetails=$CartDetails}}
{{updateCartSummary cartID=$CartID cartData=$CartDataItem cartDetails=$CartDetails}}

{{if $smarty.post.checkout eq 'Checkout'}}
	{{* We do not close the cart{{CollectionUpdateField CollectionID=$CartCollection RowID=$CartID Value='on' ColumnID=28}} *}}
	{{assign var=errors value=''}}
	{{if $smarty.post.zipcode eq ''}}
		{{assign var=errors value=$errors|concat:"<li>Please fill the zip code field</li>"}}
	{{/if}}
	{{if $smarty.post.paymentmethod eq ''}}
		{{assign var=errors value=$errors|concat:"<li>Please choose a payment method</li>"}}
	{{/if}}
	{{if $errors eq ''}}
		{{getCollectionByCategory CollectionID=$CartDetailsCollection ColumnID=1 Value=$CartID var=CartDetailsWithCollection OrderColumn='ID' aditionalFilter=' Collection_'|concat:$CartDetailsCollection|concat:'_9 > 0  ' }}
		{{if $CartDetailsWithCollection|@count gt 0}}
			{{redirect page='/checkout/additional-information.html'}}
		{{else}}
			{{redirect page='/checkout/personal-information.html'}}
		{{/if}}
	{{/if}}	
{{else}}
	{{redirect page='/shopping-cart.html'}}
{{/if}}
			
{{/if}}