Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    This usually means there’s faulty HTML in your template, which is often caused by an error right in the middle of a table for example. If you output to HTML (see FAQ), you will probably see that error.

    Let me know what you find and I’ll try to help you fix it.

    Thread Starter ret

    (@blubb)

    Now that’s strange, i’m using default templates. Any suggestions? Already enabled HTML output, everything is displayed without any issue.

    Plugin Contributor Ewout

    (@pomegranate)

    did you also enable WP_DEBUG?

    Even if you’re using default templates, there could be plugins that alter some of the output in the template. You can also try running the template output through an HTML validator (like https://validator.w3.org/#validate_by_input). I am pretty sure that the getAttribute() error refers to a problem with the HTML.

    Plugin Contributor Ewout

    (@pomegranate)

    @ret, did you find the cause of this issue?
    Let me know if you still have any issues!

    Thread Starter ret

    (@blubb)

    Hi,

    sorry for the delay. Unfortunately this issue still exists. Any further ideas? I have run it through the HTML validator – 14 errors.

    like…

    …”item-name”>Product Name</span><span class=”item-meta”><dl class=”variation”>

    I am using default templates of the plugin.

    Thank you!

    Thread Starter ret

    (@blubb)

    … the packing list is working properly – same logo, same name and so on. I don’t think that there is a special char which produces the error.

    Thread Starter ret

    (@blubb)

    At least i’ve figured it out, this part from invoice.php

    <?php foreach( $wpo_wcpdf->get_woocommerce_totals() as $key => $total ) : ?>
    						<tr class="<?php echo $key; ?>">
    							<td class="no-borders">&nbsp;</td>
    							<th class="description"><?php echo $total['label']; ?></th>
    							<td class="price"><span class="totals-price"><?php echo $total['value']; ?></span></td>
    						</tr>
    						<?php endforeach; ?>

    Is causing the issue. Inside my theme, i’ve defined a text for woocommerce_de_small_business_regulation_text – if this is deleted, pdfs are created.

    Plugin Contributor Ewout

    (@pomegranate)

    Glad to hear you’ve figured it out! I have seen this before with German users/WooCommerce German Market, it’s an improper usage of a woocommerce action that is not meant for output… (they should have used filters instead!).

    Thread Starter ret

    (@blubb)

    Well, if i delete the block no totals are shown on the PDF. How can i fix that, or isn’t that something for your plugin? thx.

    Plugin Contributor Ewout

    (@pomegranate)

    No, you simply have to delete the woocommerce_de_small_business_regulation_text and output it in another way/location. IIRC this function is used to echo something upon calling the woocommerce_get_order_item_totals filter.

    There’s an important difference between actions and filters in WordPress:
    Actions are meant to execute a function or output certain text/html, filters are meant to change/filter a variable.

    In this case, this is about a filter for the woocommerce totals: woocommerce_get_order_item_totals is meant to make changes to the total rows (add new rows, modify how it’s displayed, labels, etc.). This filter gets executed when the total rows are requested. Because it’s not an action, no output is expected/supposed to be given. I can only request these totals in the middle of the table, because I have to loop through each <tr>. Your filter (mistreated like an action) gives this kind of output:

    <table>
    Umsatzsteuerbefreit nach §4 UstG
    <tr>
      <td>Label</td>
      <td>€10</td>
    </tr>
    </table>

    As you can see, this is not proper HTML (there’s not supposed to be any output outside of a td), and that’s why the PDF engine crashes.
    I advise you to contact German Market Press support to come up with a better solution.

    Hope that helps!
    Ewout

    Thread Starter ret

    (@blubb)

    Great, thanks for your support!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Fatal error – DOMText’ is closed to new replies.