Skip to content

Commit

Permalink
Ensure to check if a token exists in NC pro docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar committed Feb 22, 2024
1 parent d130594 commit b59fcaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ Gesamttotal: ##gesamttotal##
So könnte unsere Twig-Logik könnte dann wie folgt aussehen:

```twig
{% set subtotal = rawTokens.byName('form_anzahl_prospekte').value * 4 %}
{% set mwst = subtotal * 19 / 100 %}
{% set gesamttotal = subtotal + mwst %}
{% if rawTokens.has('form_anzahl_prospekte') %}
{% set subtotal = rawTokens.byName('form_anzahl_prospekte').value * 4 %}
{% set mwst = subtotal * 19 / 100 %}
{% set gesamttotal = subtotal + mwst %}
{% endif %}
```

Diese Logik kopieren wir nun in 3 Tokens und geben jeweils die gewünschte Variable aus:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ Total amount: ##total##
So könnte unsere Twig-Logik könnte dann wie folgt aussehen:

```twig
{% set subtotal = rawTokens.byName('form_number_of_brochures').value * 4 %}
{% set tax = subtotal * 19 / 100 %}
{% set total = subtotal + tax %}
{% if rawTokens.has('form_anzahl_prospekte') %}
{% set subtotal = rawTokens.byName('form_number_of_brochures').value * 4 %}
{% set tax = subtotal * 19 / 100 %}
{% set total = subtotal + tax %}
{% endif %}
```

We now copy this logic into 3 tokens and output the desired variable in each case:
Expand Down

0 comments on commit b59fcaa

Please sign in to comment.