Jump to content
  • 0

How To Use {% Debug %} Tag In Email Templates


Alk

Question

Hello,

 

I am trying to use the {% debug %} tag in the "Invoice Delivery (Paid)" email template to see what tags are available for {invoice}. So I have wiped out the text that I had in the template and replaced it with {% debug %}. I then went to a paid invoice and sent a copy of this email to myself. Unfortunately, all that I receive is a blank email! 

 

Please could you help?

 

Thanks!

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Many thanks for taking the time to do that Mike. Whilst I have been able to get this to work for the password reset email template, it does not work for the "Invoice Delivery (Paid)" email template. There must be something about this email template that it doesn't work for it. Could the Blesta team please lend a hand?

Link to comment
Share on other sites

  • 0

Many thanks for taking the time to do that Mike. Whilst I have been able to get this to work for the password reset email template, it does not work for the "Invoice Delivery (Paid)" email template. There must be something about this email template that it doesn't work for it. Could the Blesta team please lend a hand?

 

Sure they'll be able to help you soon they might pop on but they are open again on Monday 9am PST.

Link to comment
Share on other sites

  • 0

I'm not sure why the email is blank for you. Perhaps you added the {% debug %} statement into the wrong type (HTML/Text)?

 

This appears to work fine for me, so to clarify:

  1. Navigate to [settings] -> [Company] -> [Emails] -> .
Edit the "Invoice Delivery (Paid)" template Replace both the HTML and Text versions of the email with simply "{% debug %}" Navigate to a client that has paid invoices under [Clients] From the Invoices listing, click the "Closed" link to view only the closed invoices Check one of the checkboxes to the left of an invoice Make sure "Deliver via Email" is selected, along with your email address, and click to Submit Check your email.

 

Sample output:

[invoices] => Array
    (
        [0] => stdClass Object
            (
                [id] => 328
                [id_format] => {num}
                [id_value] => 22
                [client_id] => 1
                [date_billed] => 2014-07-21 19:39:44
                [date_due] => 2014-07-21 19:39:44
                [date_closed] => 2014-07-21 19:39:46
                [date_autodebit] => 
                [status] => active
                [subtotal] => 1.3900
                [total] => 1.4000
                [paid] => 1.4000
                [previous_due] => 2.8000
                [currency] => USD
                [note_public] => 
                [note_private] => 
                [id_code] => PD-22
                [delivery_date_sent] => 2014-07-21 19:39:51
                [due] => 0
                [line_items] => Array
                    (
                        [0] => stdClass Object
                            (
                                [id] => 542
                                [invoice_id] => 328
                                [service_id] => 222
                                [description] => Product 1 - Test (Apr 02, 2014 - Jul 02, 2014)
                                [qty] => 1.0000
                                [amount] => 0.3900
                                [subtotal] => 0.39000000
                                [taxes] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [id] => 1
                                                [company_id] => 1
                                                [level] => 1
                                                [name] => Sales
                                                [amount] => 1.0000
                                                [type] => inclusive
                                                [country] => US
                                                [state] => 
                                                [status] => active
                                                [cascade] => 0
                                                [tax_total] => 0.01
                                            )

                                    )

                                [taxes_applied] => Array
                                    (
                                        [0] => Array
                                            (
                                                [id] => 1
                                                [name] => Sales
                                                [percentage] => 1.0000
                                                [amount] => 0
                                            )

                                    )

                                [tax_subtotal] => 0
                                [tax_total] => 0
                                [total] => 0.39
                                [total_w_tax] => 0.39
                            )

                        [1] => stdClass Object
                            (
                                [id] => 543
                                [invoice_id] => 328
                                [service_id] => 222
                                [description] => Product 2 - Test (Apr 02, 2014 - Aug 02, 2014)
                                [qty] => 1.0000
                                [amount] => 1.0000
                                [subtotal] => 1.00000000
                                [taxes] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [id] => 1
                                                [company_id] => 1
                                                [level] => 1
                                                [name] => Sales
                                                [amount] => 1.0000
                                                [type] => inclusive
                                                [country] => US
                                                [state] => 
                                                [status] => active
                                                [cascade] => 0
                                            )

                                    )

                                [taxes_applied] => Array
                                    (
                                        [0] => Array
                                            (
                                                [id] => 1
                                                [name] => Sales
                                                [percentage] => 1.0000
                                                [amount] => 0.01
                                            )

                                    )

                                [tax_subtotal] => 0.01
                                [tax_total] => 0.01
                                [total] => 1.01
                                [total_w_tax] => 1.01
                            )

                    )

                [delivery] => Array
                    (
                        [0] => stdClass Object
                            (
                                [id] => 321
                                [invoice_id] => 328
                                [method] => email
                                [date_sent] => 2014-07-21 19:39:51
                            )

                    )

                [meta] => Array
                    (
                    )

                [tax_subtotal] => 0.01
                [tax_total] => 0.01
                [taxes] => Array
                    (
                        [0] => stdClass Object
                            (
                                [id] => 1
                                [company_id] => 1
                                [level] => 1
                                [name] => Sales
                                [amount] => 1.0000
                                [type] => inclusive
                                [country] => US
                                [state] => 
                                [status] => active
                                [cascade] => 0
                                [tax_total] => 0.01
                            )

                    )

                [billing] => stdClass Object
                    (
                        [id] => 1
                        [client_id] => 1
                        [user_id] => 
                        [contact_type] => primary
                        [contact_type_id] => 
                        [first_name] => First Name
                        [last_name] => Last Name
                        [title] => 
                        [company] => Company
                        [email] => me@myemail.com
                        [address1] => 123 Test St.
                        [address2] => 
                        [city] => Testville
                        [state] => AK
                        [zip] => 38181
                        [country] => stdClass Object
                            (
                                [alpha2] => US
                                [alpha3] => USA
                                [name] => United States
                                [alt_name] => 
                            )

                        [date_added] => 2014-05-08 21:35:13
                        [contact_type_name] => 
                        [contact_type_is_lang] => 
                    )

                [client] => stdClass Object
                    (
                        [id] => 1
                        [id_format] => {num}
                        [id_value] => 1500
                        [user_id] => 2
                        [client_group_id] => 1
                        [primary_account_id] => 
                        [primary_account_type] => 
                        [status] => active
                        [id_code] => 1500
                        [contact_id] => 1
                        [first_name] => First Name
                        [last_name] => Last Name
                        [company] => Company
                        [email] => me@myemail.com
                        [address1] => 123 Test St.
                        [address2] => 
                        [city] => Testville
                        [state] => AK
                        [zip] => 38181
                        [country] => US
                        [group_name] => General
                        [company_id] => 1
                        [username] => me@myemail.com
                        [two_factor_mode] => none
                        [two_factor_key] => 
                        [two_factor_pin] => 
                        [date_added] => 2014-05-08 21:35:13
                        [settings] => Array
                            (
                                ...
                                [client_set_lang] => true
                                [client_view_dir] => bootstrap
                                ...
                            )

                    )

                [payment_url] => mydomain.com/clients/client/pay/method/328/?sid=NdMxFyn8bABZeuJeKxEIvG%2FXAvTifTRRYLtbtheHExW4%3D
                [autodebit_date] => 
            )

    )

Sample usage in the email template:

{% for invoice in invoices %}
Invoice #: {invoice.id_code}
Pay here: {invoice.payment_url}{% endfor %}
Link to comment
Share on other sites

  • 0

Thanks very much Tyson. I did and have done exactly as per your instructions (in particular replacing the html and text versions with just "{% debug %}") but I still get a blank email unfortunately. As I say, I can successfully get the output for the password reset email template, just not for the "Invoice Delivery (Paid)" email template.

 

Nevertheless, thank you for pasting the output on here for me.

Link to comment
Share on other sites

  • 0

Sounds strange. Did you check the client's mail log to see if the text copy there is blank as well?

 

Just checked it now and it just has:

<pre></pre>

Call to the community; would somebody else be kind enough to try as per Tyson's instructions in post #5 please? Don't forget to backup the content that you already have in your "Invoice Delivery (Paid)" template!

It would be helpful to know if others also receive a blank email, when the {% debug %} tag is present in the "Invoice Delivery (Paid)" template, as Tyson is unable to recreate the issue in order to confirm if it is a bug...Thanks!

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...