• Resolved abqdanj

    (@abqdanj)


    Receive the following error when attempting to create a pdf invoice:?Fatal error: Call to a member function get_header_logo_id() on null/users/nmpob/public_html/nmpob.org/wp-content/themes/panoramic-child-pob/woocommerce/pdf/POB Packing Slip/invoice.php (8)

    /users/nmpob/public_html/nmpob.org/wp-content/themes/panoramic-child-pob/woocommerce/pdf/POB Packing Slip/invoice.php (8)
    
    #0 /users/nmpob/public_html/nmpob.org/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(976): include()
    #1 /users/nmpob/public_html/nmpob.org/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(879): WPO\WC\PDF_Invoices\Documents\Order_Document->render_template()
    #2 /users/nmpob/public_html/nmpob.org/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(834): WPO\WC\PDF_Invoices\Documents\Order_Document->get_html()
    #3 /users/nmpob/public_html/nmpob.org/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(901): WPO\WC\PDF_Invoices\Documents\Order_Document->get_pdf()
    #4 /users/nmpob/public_html/nmpob.org/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-main.php(466): WPO\WC\PDF_Invoices\Documents\Order_Document->output_pdf()
    #5 /users/nmpob/public_html/nmpob.org/wp-includes/class-wp-hook.php(310): WPO\WC\PDF_Invoices\Main->generate_pdf_ajax()
    #6 /users/nmpob/public_html/nmpob.org/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #7 /users/nmpob/public_html/nmpob.org/wp-includes/plugin.php(517): WP_Hook->do_action()
    #8 /users/nmpob/public_html/nmpob.org/wp-admin/admin-ajax.php(188): do_action()
    #9 {main}

    WordPress 6.3.1 running Panoramic theme version 10.2.54
    Server running PHP version: 8.1.17.
    PDF Invoices & Packing Slips for WooCommerce plugin Version 3.6.3
    (first attempt to create a pdf since updating to 3.6.3.)

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @abqdanj,

    This issue is happening because in the last release we deleted legacy code that we were maintaining for years. Currently, the global variable $wpo_wcpdf no longer exists, that is why the error is generated.

    However, you can follow these steps to fix this issue:

    1. Replace the whole code of the html-document-wrapper.php file with the current one you will find here.
    2. Open the invoice.php file, and do the following:
      1. Replace the first like with this one:
        Testing
      2. Replace every concurrence of $wpo_wcpdf with $this
      3. Replace every concurrence of 'wpo_wcpdf' with 'woocommerce-pdf-invoices-packing-slips': This is the text domain which is needed in order for translations to work.
    3. If need it, repeat the steps of the 2nd point for the packing slip too.
    Thread Starter abqdanj

    (@abqdanj)

    I think not. I spent the time instead to replace this with a free plugin that actually works!

    I have the same problem.. Will try your suggestion @yordansoares, but I’m wondering if there was a warning or deprecation message that I might have been missing? When sudden breaking changes like this happen with a plugin (which I am paying for), one of my initial reactions is also to start looking for more stable alternatives. I hope next time you remove some legacy code that has the potential to break a site, it’s made clear trough to some kind of warning in the WP-dashboard so we can start making changes before the site actually breaks.

    Got it working again. But what do you mean by this?:

    1. Replace the first like with this one:
      Testing
    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @jules-colle,

    I have the same problem.. Will try your suggestion?@yordansoares, but I’m wondering if there was a warning or deprecation message that I might have been missing?

    In fact, we made a mistake in not giving a timely warning about the removal of the legacy code, so I have to apologize on behalf of the team for the inconvenience.

    We wrongly assumed, that enough time had passed to remove this legacy code that we were maintaining since early 2017. Actually, this code was no longer used in our default templates since then. But we didn’t count on the fact that there were users who were still using legacy code.

    That’s why we are offering free support to update the deprecated templates to all our users (normally, custom PDF templates are not supported), even updating the files by ourselves, if them are shared with us.

    That said, we have learned from this experience and will be much more careful in the future when making similar changes.

    Thank you very much for your feedback: It is greatly appreciated!

    Got it working again. But what do you mean by this?: Replace the first like with this one: Testing

    My bad! That was a mistake from my side. I was testing the forum editor to format that line code (it turned out that it has some well-known formatting issues), but while playing with the formatting, the editing time was over, and I was not able to restore the actual code. Things happens when you do not have an actual preview!

    Anyway, instead of Testing, you have to put there the following code:

    <code><?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?></code></li>

    The line above, it’s just a safety practice, which you may know very well: I have used (and contributed with) your conditional fields extension for Contact Form 7! ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal error: Call to a member function get_header_logo_id() on null’ is closed to new replies.