Support

Home Forums Event Espresso Premium HTML Invoice Message Template Error

HTML Invoice Message Template Error

Posted: November 22, 2017 at 8:55 am


George

November 22, 2017 at 8:55 am

Hello,

I created a custom HTML template for invoice template..Everything works well until i click the generate pdf link. My web browser keeps loading until it displays an error 500. EE also writes up-to 8MB of data to WP debug.log

On inspection of the generated error logs, i noticed the following lines recurring:

[22-Nov-2017 15:10:24 UTC] PHP Notice:  Undefined offset: 0 in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/style.cls.php on line 836
[22-Nov-2017 15:10:24 UTC] PHP Warning:  A non-numeric value encountered in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/table_frame_reflower.cls.php on line 557
[22-Nov-2017 15:10:24 UTC] PHP Notice:  A non well formed numeric value encountered in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/style.cls.php on line 472
[22-Nov-2017 15:10:24 UTC] PHP Warning:  A non-numeric value encountered in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/table_cell_frame_reflower.cls.php on line 99
[22-Nov-2017 15:10:24 UTC] PHP Notice:  A non well formed numeric value encountered in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/style.cls.php on line 472
[22-Nov-2017 15:10:24 UTC] PHP Warning:  A non-numeric value encountered in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/table_frame_reflower.cls.php on line 557

At this point, I’m lost, confused & frustrated. Please can you help me see what I’m doing wrong? Maybe my CSS is causing issues or my html is a bit off? Please help me look into this.

Can you provide me with a secure way to share my website access credentials?
I have attached the full debug.log and html invoice templates. Please click the links to access them.

https://www.kizomba.ng/support/plugins_support/event_espresso/message_template_error/debug_log_22112017.zip

https://www.kizomba.ng/support/plugins_support/event_espresso/message_template_error/html_template_pack.zip

Thank you.


Josh

  • Support Staff

November 22, 2017 at 1:57 pm

Hi George,

I reviewed the html templates and I’m afraid there are parts of the html within the templates that will result in invalid html, and the DOMPDF scripts cannot always handle invalid html.

The way forward will be to make copies of the original templates from Event Espresso and modify them to suit your needs. The following is a list of your templates that need to be fixed:

html_invoice_additional_line_item_list.template.php
html_invoice_content.template.php
html_invoice_payment_list.template.php
html_invoice_price_modifier_line_item_list.template.php
html_invoice_tax_line_item_list.template.php
html_invoice_ticket_line_item_no_pms.template.php
html_invoice_ticket_line_item_pms.template.php
html_invoice_ticket_list.template.php

Quite frankly I’m a bit puzzled over all the additional markup that was added to the above templates. If you switch over to the default template pack (and do a template reset) does the Invoice generate a PDF without the errors?


George

November 22, 2017 at 2:08 pm

Hi Josh,

Thank you for your support.

Yes, i did create a messaging template plugin (followed the docs instructions).

Please can you point me in the right direction with regards which html tags are invalid so i may remove them, i don’t know which ones are invalid and the debug.log isn’t mentioning any tags.

I’d really appreciate this.

Thank you


Josh

  • Support Staff

November 22, 2017 at 2:26 pm

It’s not so much as issue where you have invalid tags so to speak. The issue seems to be you’ve added a lot of nested html that doesn’t seem even to be necessary.

The way forward, or right direction if you will, will be to start with the default templates and add only what’s necessary. An example of something that’s not necessary is the multiple of additional html tables within tables. The HTML invoice isn’t an email, so need for all of those. Also, when adding additional markup please bear in mind that if you open a tag in a template that starts a section you will need to close that tag in the template that ends that section.


Josh

  • Support Staff

November 22, 2017 at 2:55 pm

Along with the above, if you have concern that your CSS is causing an issue, then it will help to know how that CSS is being included into the invoice and the contents of that CSS.


George

November 23, 2017 at 9:40 am

Hello Josh,

Thank you. With your support & guideance, i was able to recreate the templates from scratch and removed all uneccesary/redundant tags and which reduced each file by up to 80%. pdf downloads now works.

However, im still receving this errors in debug:

[23-Nov-2017 16:11:32 UTC] PHP Warning:  Division by zero in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/lib/class.pdf.php on line 3707
[23-Nov-2017 16:11:32 UTC] PHP Notice:  Undefined offset: 0 in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/style.cls.php on line 836
[23-Nov-2017 16:11:32 UTC] PHP Warning:  A non-numeric value encountered in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/table_frame_reflower.cls.php on line 557
[23-Nov-2017 16:11:32 UTC] PHP Notice:  Undefined offset: 0 in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/style.cls.php on line 836
[23-Nov-2017 16:11:32 UTC] PHP Warning:  A non-numeric value encountered in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/table_frame_reflower.cls.php on line 557
[23-Nov-2017 16:11:32 UTC] PHP Warning:  Division by zero in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/text_frame_decorator.cls.php on line 90
[23-Nov-2017 16:11:32 UTC] PHP Warning:  A non-numeric value encountered in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/block_frame_reflower.cls.php on line 416
[23-Nov-2017 16:11:32 UTC] PHP Notice:  A non well formed numeric value encountered in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/style.cls.php on line 472
[23-Nov-2017 16:11:32 UTC] PHP Warning:  A non-numeric value encountered in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/table_frame_reflower.cls.php on line 557
[23-Nov-2017 16:11:32 UTC] PHP Notice:  Undefined offset: 0 in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/style.cls.php on line 836
[23-Nov-2017 16:11:32 UTC] PHP Warning:  A non-numeric value encountered in /home/manndi93/public_html/wp-content/plugins/event-espresso-core-reg/core/third_party_libs/dompdf/include/page_frame_decorator.cls.php on line 439

And the created pdf file it almost 6 to 10 pages that are mostly blank.

Please can you also help with this? Im suspecting its coming from my pdf css but im not sure what to do or look for in this case.

Here’s a link to my debug.log
https://www.kizomba.ng/support/plugins_support/event_espresso/message_template_error/debug_log_23112017.zip

Thanks!


Josh

  • Support Staff

November 23, 2017 at 10:12 am

Please can you also help with this? Im suspecting its coming from my pdf css but im not sure what to do or look for in this case.

Where might I be able to download your pdf CSS and the script that loads that CSS so I can help you with that?


George

November 23, 2017 at 10:24 am

Hello Josh,

I have included the stripped version of my EE message plugin (just to include the html templates, CSS, plugin files – for your reference). Please follow this link:
https://www.kizomba.ng/support/plugins_support/event_espresso/message_template_error/eea-kzn-messages-template-pack.zip

and the script that loads that CSS

I’m not sure i understand what scripts because in my template, i added this CSS directly in the html_main_wrapper.template.php file. Please take a look at my custom plugin to see this. Perhaps im doing something wrong.

Thanks alot!


Josh

  • Support Staff

November 23, 2017 at 10:35 am

May I ask why the stripped version? Please help us help you by including all of the code so we don’t have to guess about the other parts that you didn’t include.


George

November 23, 2017 at 11:06 am

Hi Josh,

I only removed the template files i don’t have an issue with and included only the HTML Invoice template so we dont mix things up thats all.

Please follow this link for the complete custom message plugin.
https://www.kizomba.ng/support/plugins_support/event_espresso/message_template_error/eea-kzn-messages-template-pack.zip
Thanks alot!


Josh

  • Support Staff

November 23, 2017 at 1:30 pm

Can you run the generated html invoice through an html validator and check for errors?


George

November 23, 2017 at 3:04 pm

There were some HTML validation errors caused by tag formatting and obsulate tags & attributes.

I have corrected them & updated zip file.

Please use same link to download
https://www.kizomba.ng/support/plugins_support/event_espresso/message_template_error/eea-kzn-messages-template-pack.zip

Thanks!


Josh

  • Support Staff

November 24, 2017 at 8:12 pm

Hi George,

That helps, thanks.

The reason for the blank pages in the PDF is because of this CSS from your custom html_main_default.css stylesheet, starting on line 56:

.email_body, .content_cell, .col_0, .col_1, .col_12, .col_2, .col_3, .col_thumb, .col_description {
	font-size: 0 !important;
	line-height: 100%;
}

You can remove that CSS and you’ll see that the invoice will fill 1-2 pages at most. One thing to watch out for with DOMPDF generated PDFs is they do not support all of CSS 2.1 properties and very little of CSS 3’s properties. Here’s a link to the DOMPDF wiki that shows which properties are supported:
https://github.com/dompdf/dompdf/wiki/CSSCompatibility#properties

The recommended way to customize the invoices is start with the defaults and tweak the html and CSS only where needed. You’ll find that if you do a complete overhaul of the markup and CSS it can be very difficult to get the DOMPDF generated invoice to match the html invoice displayed in the browser.


George

November 29, 2017 at 12:38 pm

Thanks alot Josh,

The extra pages are all gone but i noticed the pages are shrinked (like the css is still not 100% ok) Any ideas as to what might be causing it?

Im just lost


Josh

  • Support Staff

November 29, 2017 at 12:45 pm

The script that generates the PDF (DOMPDF) does not support all CSS 2.1 properties and very few of CSS3’s properties. Here’s a link to the DOMPDF wiki that shows which properties are supported:

https://github.com/dompdf/dompdf/wiki/CSSCompatibility#properties

The support post ‘HTML Invoice Message Template Error’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso