Jump to content
  • 0

Email Template Invoice Delivery


NETLINK

Question

Hello!

 

I have the following in my invoice template:

 

{% if autodebit %}{% if invoice.autodebit_date_formatted %}Auto debit is enabled for your account, so we'll automatically process the card you have on file on {invoice.autodebit_date_formatted} unless payment has been applied sooner.{% else %}If you would like us to automatically charge your card, please log in to your account at http://{client_url} to set up auto debit.{% endif %}{% else %}If you would like us to automatically charge your card, please log in to your account at https://{client_url} to set up auto debit.{% endif %}

 

I'm wondering why the {else} statement is in there twice. When I remove the second one, I get the following error:

 

"Template parse error: endfor tag doesn't exist"

 

I'm just trying to understand the logic.

 

Thanks!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

There is a nested conditional with else statements for each of them.

{% if autodebit %}
    {% if invoice.autodebit_date_formatted %}
        Auto debit is enabled for your account, so we'll automatically process the card you have on file on {invoice.autodebit_date_formatted} unless payment has been applied sooner.
    {% else %}
        If you would like us to automatically charge your card, please log in to your account at http://{client_url} to set up auto debit.
    {% endif %}
{% else %}
    If you would like us to automatically charge your card, please log in to your account at https://{client_url} to set up auto debit.
{% endif %}

I'm wondering why the {else} statement is in there twice. When I remove the second one, I get the following error:
 
"Template parse error: endfor tag doesn't exist"

 

It sounds like you removed more than just that else statement. There is no endfor tag in the template you included, so it may be an error caused somewhere else, or due to broken syntax (e.g. missing endif). Examples in the docs.

Link to comment
Share on other sites

  • 0

Hello!

 

I have the following in my invoice template:

 

 

I'm wondering why the {else} statement is in there twice. When I remove the second one, I get the following error:

 

"Template parse error: endfor tag doesn't exist"

 

I'm just trying to understand the logic.

 

Thanks!

 

You have the extra 

{% endif %}

if you remove that next to the else tag you will be fine.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...