{{vtScript}}
{{vtInclude:includes/initialize.html}}
{{vtIf: {vtGetValue:o} .gt. 0}}
{{vtUse: {vtGetValue:o} }}
{{vtSet: Token="{Token}"}}
{{vtSet: Bestellnummer="{Nummer}"}}
{{vtIf: {Bezahlmethode} .in. rechnung|lastschrift|sepa .and. {abgeschlossen} .eq. 1 }}
{{vtSet: bezahlt="1"}}
{{vtElse}}
{{vtSet: bezahlt="{bezahlt}"}}
{{vtEndIf}}
{{vtSet: Warenkorb="{Warenkorb:raw}"}}
{{vtSet: Kunde="{Vorname} {Name}"}}
{{vtEndUse}}
{{vtElse}}
{{vtSet: Token="x"}}
{{vtEndIf}}
{{vtIf: {vtGlobal:pxtcPathHires} .bw. / }}
{{vtSet: pxtcPathHires = "{vtGlobal:pxtcPathHires}" }}
{{vtElse}}
{{vtSet: pxtcPathHires = "{vtConfig:pathToVirthos}{vtGlobal:pxtcPathHires}" }}
{{vtEndIf}}
{{vtIf: {vtGet:bezahlt} .eq. 1 .and. {vtGet:Token} .eq. {vtGetValue:t} }}
{{vtRepeat:{vtGet:Warenkorb} }}
{{vtIf: {vtItem:type} .eq. file .and. {vtItem:hires_path} .neq.}}
{{vtCalc: trim( '{vtItem:folder,escaped}', '/' ) }}
{{vtSet: File="{vtResult}/{vtItem:hires_path}"}}
{{vtCalc: file_exists( '{vtGet:pxtcPathHires}/{vtGet:File,raw}' ) ? '1' : '' }}
{{vtIf: {vtResult} .eq. 1 }}
{{vtSet: FinalList = "{vtGet:FinalList}|{vtGet:File,raw}" }}
{{vtEndIf}}
{{vtEndIf}}
{{vtEndRepeat}}
{{vtEndIf}}
{{vtIf: {vtGet:FinalList} .neq.}}
{{vtCalc: getZipMethod() }}
{{vtSet: ZipMethod }}
{{vtIf: {vtGet:ZipMethod} .eq. external }}
{{vtCalc: create_zip_file( 'bilder.zip', '{vtGet:pxtcPathHires,escaped}', '{vtGet:FinalList,escaped}' ) }}
{{vtSet: ZipFile}}
{{vtEndIf}}
{{vtIf: {vtGet:ZipFile} .cn. : .or. {vtGet:ZipMethod} .eq. internal }}
{{vtIf: {vtGlobal:mailRecipient} .neq.}}
{{vtSet: Mailtext="{vtInclude:mails/notify_order_download.txt}"}}
{{vtDo: -act="mail", -to="{vtGlobal:mailRecipient}", -subject="Pixtacy-Download zu Bestellung Nr. {vtGet:Bestellnummer} (zip)", -message="{vtGet:Mailtext,raw}" }}
{{vtEndIf}}
{{vtIf: {vtGet:ZipMethod} .eq. external }}
{{vtRedirect: -url="{vtGet:ZipFile}" }}
{{vtEndIf}}
{{vtEndIf}}
{{vtEndIf}}
{{vtEndScript}}{{vtInclude:download.html}}