Skip to main content

Documentation Index

Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt

Use this file to discover all available pages before exploring further.

Für eine Übersicht der Voucher Tags, klicken Sie hier

Eingabe & Löschen eines Gutscheins auf der Warenkorbseite

Fügen Sie in das Template views/basket.htm folgende Codebeispiele ein

Voucher einlösen

{{ var $cActionVoucherAdd = $wsActions.create("VoucherAdd") }}

{{ if $wsVoucher.vouchers }}
   Gutscheine vorhanden
   {{= $wsVoucher | json }}
{{ else }}
   Keine Gutscheine vorhanden
{{ /if }}

<form method="post" action="{{= $wsViews.current.url() }}">
   <input type="hidden" name="wsact" value="{{= $cActionVoucherAdd.id }}">
   <input type="hidden" name="wscsrf" value="{{= $cActionVoucherAdd.csrf }}">
   <input type="hidden" name="wstarget" value="{{= $wsViews.current.url() }}">

   <input type="text" name="id" value="" placeholder="Gutschein-Code">
   <button type="submit">Einlösen</button>
</form>

Fehlermeldungen

{{ if $cActionVoucherAdd.error }}
   Es sind Fehler aufgetreten:
   {{ foreach $cError in $cActionVoucherAdd.errors }}
      {{ if $cActionVoucherAdd.text }}
         {{= $cActionVoucherAdd.text }} ({{= $cActionVoucherAdd.field }})
      {{ else }}
         {{= $cActionVoucherAdd.code }} ({{= $cActionVoucherAdd.field }})
      {{ /if }}
   {{ /foreach }}
{{ /if }}

Voucher löschen

{{ if $wsVoucher.vouchers }}
   {{ foreach $voucher in $wsVoucher.vouchers }}
      {{ var $action = $wsActions.create("VoucherDelete") }}
      <form method="post" action="{{= $wsViews.viewUrl('basket.htm') }}">
         <input type="hidden" name="id" value="{{= $voucher.id }}">
         <input type="hidden" name="wsact" value="{{= $action.id }}">
         <input type="hidden" name="wscsrf" value="{{= $action.csrf }}">
         <input type="hidden" name="wstarget" value="{{= $wsViews.current.url() }}">
         Gutschein {{= $voucher.id }}
         <button type="submit">löschen</button>
      </form>
      {{= ($voucher.value - $voucher.usedValue) | currency }}
   {{ /foreach }}
{{ /if }}