{{if $smarty.session.UserID gt 0}}

{{assign var=CartCollection				value=33}}
{{assign var=CartDetailsCollection		value=34}}
{{assign var=SessionID   		value=''|sessionid}}
{{getCollectionByCategory CollectionID=$CartCollection Collection_33_1=$SessionID aditionalFilter='Collection_33_5<>"on"' var=OldCartData OrderColumn='ID'}}


{{getCollectionByCategory CollectionID=33 Collection_33_2=$smarty.session.UserID aditionalFilter=' (Collection_33_5<>"on" or Collection_33_5 IS NULL) AND Collection_33_1 <> "'|concat:$SessionID|concat:'" ' var=CartData OrderColumn='ID'}}
{{if $CartData|@count gt 0 and $OldCartData|@count eq 0}}
	{{assign var=CartDataItem value=$CartData[0]}}
	{{assign var=CartID value=$CartDataItem.Collection_33_ID}}
	{{CollectionUpdateField CollectionID=33 ColumnID=1 Value=$SessionID RowID=$CartID}}
        {{redirect page=$smarty.server.REDIRECT_SCRIPT_URL}}
{{/if}}
{{/if}}