• Resolved tvalades

    (@tvalades)


    good morning, I have been using this plugin on the page for about two years and it creates all the invoices without any problem. Today we have found the problem that in one of our orders when trying to create the invoice the following error appears. It only happens to us in that invoice, in the rest it is created without problem. I have been looking through the forum, we have not changed the template nor do we have the badge design plugin that we have seen that previously gave problems.

    Error:

    Fatal error: Call to a member function get_cellmap() on null
    /home/grtendencias/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameReflower/TableCell.php (41)
    #0 /home/grtendencias/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(916): Dompdf\FrameReflower\TableCell->reflow(Object(Dompdf\FrameDecorator\Block))
    #1 /home/grtendencias/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameReflower/Block.php(865): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow(Object(Dompdf\FrameDecorator\Block))
    #2 /home/grtendencias/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(916): Dompdf\FrameReflower\Block->reflow(NULL)
    #3 /home/grtendencias/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameReflower/Page.php(142): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow()
    #4 /home/grtendencias/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(916): Dompdf\FrameReflower\Page->reflow(NULL)
    #5 /home/grtendencias/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Dompdf.php(770): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow()
    #6 /home/grtendencias/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-pdf-maker.php(52): Dompdf\Dompdf->render()
    #7 /home/grtendencias/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(752): WPO\WC\PDF_Invoices\PDF_Maker->output()
    #8 /home/grtendencias/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(814): WPO\WC\PDF_Invoices\Documents\Order_Document->get_pdf()
    #9 /home/grtendencias/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-main.php(376): WPO\WC\PDF_Invoices\Documents\Order_Document->output_pdf('inline')
    #10 /home/grtendencias/www/wp-includes/class-wp-hook.php(303): WPO\WC\PDF_Invoices\Main->generate_pdf_ajax('')
    #11 /home/grtendencias/www/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array)
    #12 /home/grtendencias/www/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
    #13 /home/grtendencias/www/wp-admin/admin-ajax.php(187): do_action('wp_ajax_generat...')
    #14 {main}

    The page I need help with: [log in to see the link]

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

    (@yordansoares)

    Hi @tvalades,

    This is indeed mostly caused by custom PDF templates bad coded, but also in empty tables, which is an issue we discovered in the last version of our PDF engine, in combination with a PHP 8 setup. That’s why we updated all our templates, to avoid this behavior.

    Please provide us with this info to try to understand what’s your case:

    1. The version of our plugin you’re using under Plugins > Installed Plugins
    2. The selected template you have under WooCommerce?> PDF?Invoices?> General?> Choose a template. Please note if it says Custom between round brackets.
    3. A screenshot of your system configuration under WooCommerce?> PDF?Invoices?> Status. You can use imgbb.com to upload the screenshot, and then share the image URL here.
    Thread Starter tvalades

    (@tvalades)

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Thanks for providing that info, @tvalades!

    Then, I’m afraid some plugin is adding a malformed HTML code to your item meta or directly to your PDF documents.

    If you have a staging site, could you please temporarily disable all your plugins, except WooCommerce and WooCommerce PDF Invoices & Packing Slips too see if the PDF invoices works correctly? If so, then start activating your plugins, one by one, reloading your PDF document, to try to find the “culprit”.

    In the case you find it, please tell me which one it is, so I can try to find a workaround to fix the issue in the PDF documents.

    Thread Starter tvalades

    (@tvalades)

    good morning, I’ve tried uninstalling all the plugins except those two and it still won’t let me create the invoice, the error keeps popping up

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Did you try creating a testing order, after disabling all the plugins, except WooCommerce and WooCommerce PDF Invoices & Packing Slips?

    Thread Starter tvalades

    (@tvalades)

    yes, i have tried it

    Plugin Contributor Yordan Soares

    (@yordansoares)

    This is weird. Could you please write us at [email protected], so we can try another ways to fix this? Please mention the URL of this topic in your message.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Update: @tvalades sent a message by mail and I reviewed their site. As I mentioned above, this indeed turned out an issue caused by the value from an item meta that was wrapped inside an HTML table malformed (it was missing an opening <tr> tag) added with the PPOM for WooCommerce plugin.

    I shared this code snippet with @tvalades to disable the item meta in the order with this issue:

    /**
     * WooCommerce PDF Invoices & Packing Slips:
     * Remove specific item meta keys from the PDF documents
     */
    add_filter( 'wpo_wcpdf_html_filters', function( $filters ) {
    	$filters[] = array( 'woocommerce_order_item_get_formatted_meta_data', 'wpo_remove_specific_item_meta_from_pdf_documents', 999, 2 );
    	return $filters;
    } );
    function wpo_remove_specific_item_meta_from_pdf_documents( $formatted_meta, $item ){
    	foreach( $formatted_meta as $key => $meta ){
    		// One item meta key per line
    		$item_meta_disabled = array(
    			'item_meta_key',
    		);
    		if( in_array( $meta->key, $item_meta_disabled ) ) {
    			unset( $formatted_meta[$key] );
    		}
    	}
    	return $formatted_meta;
    }

    I hope this helps anyone who has this same issue!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Error al intentar generar el documento: Call to a member function get_cellmap()’ is closed to new replies.