• Resolved bestoffitpack

    (@bestoffitpack)


    Hello, until now my custom template worked perfectly however since the last WP update I have this error when I try to create an invoice.

    I would like to point out that I have changed absolutely nothing in the configuration or in the invoice.php file.

    Attached image : https://zupimages.net/viewer.php?id=22/07/kfoo.jpg

    And my template :

    <?php if ( ! defined( ‘ABSPATH’ ) ) exit; // Exit if accessed directly ?>

    <?php do_action( ‘wpo_wcpdf_before_document’, $this->type, $this->order ); ?>

    <table class=”head container”>

    <tr>

    <td class=”header”>

    <?php

    if( $this->has_header_logo() ) {

    $this->header_logo();

    } else {

    echo $this->get_title();

    }

    ?>

    </td>

    <td class=”shop-info”>

    <?php do_action( ‘wpo_wcpdf_before_shop_name’, $this->type, $this->order ); ?>

    <div class=”shop-name”><h3><?php $this->shop_name(); ?></h3></div>

    <?php do_action( ‘wpo_wcpdf_after_shop_name’, $this->type, $this->order ); ?>

    <?php do_action( ‘wpo_wcpdf_before_shop_address’, $this->type, $this->order ); ?>

    <div class=”shop-address”><?php $this->shop_address(); ?></div>

    <?php do_action( ‘wpo_wcpdf_after_shop_address’, $this->type, $this->order ); ?>

    </td>

    </tr>

    </table>

    <h1 class=”document-type-label”>

    <?php if( $this->has_header_logo() ) echo $this->get_title(); ?>

    </h1>

    <?php do_action( ‘wpo_wcpdf_after_document_label’, $this->type, $this->order ); ?>

    <table class=”order-data-addresses”>

    <tr>

    <td class=”address billing-address”>

    <!– <h3><?php _e( ‘Billing Address:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></h3> –>

    <?php do_action( ‘wpo_wcpdf_before_billing_address’, $this->type, $this->order ); ?>

    <?php $this->billing_address(); ?>

    <?php do_action( ‘wpo_wcpdf_after_billing_address’, $this->type, $this->order ); ?>

    <?php if ( isset($this->settings[‘display_email’]) ) { ?>

    <div class=”billing-email”><?php $this->billing_email(); ?></div>

    <?php } ?>

    <?php if ( isset($this->settings[‘display_phone’]) ) { ?>

    <div class=”billing-phone”><?php $this->billing_phone(); ?></div>

    <?php } ?>

    </td>

    <td class=”address shipping-address”>

    <?php if ( !empty($this->settings[‘display_shipping_address’]) && ( $this->ships_to_different_address() || $this->settings[‘display_shipping_address’] == ‘always’ ) ) { ?>

    <h3><?php _e( ‘Ship To:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></h3>

    <?php do_action( ‘wpo_wcpdf_before_shipping_address’, $this->type, $this->order ); ?>

    <?php $this->shipping_address(); ?>

    <?php do_action( ‘wpo_wcpdf_after_shipping_address’, $this->type, $this->order ); ?>

    <?php } ?>

    </td>

    <td class=”order-data”>

    <table>

    <?php do_action( ‘wpo_wcpdf_before_order_data’, $this->type, $this->order ); ?>

    <?php if ( isset($this->settings[‘display_number’]) ) { ?>

    <tr class=”invoice-number”>

    <th><?php _e( ‘Invoice Number:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>

    <td><?php $this->invoice_number(); ?></td>

    </tr>

    <?php } ?>

    <?php if ( isset($this->settings[‘display_date’]) ) { ?>

    <tr class=”invoice-date”>

    <th><?php _e( ‘Invoice Date:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>

    <td><?php $this->invoice_date(); ?></td>

    </tr>

    <?php } ?>

    <tr class=”order-date”>

    <th><?php _e( ‘Order Date:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>

    <td><?php $this->order_date(); ?></td>

    </tr>

    <tr class=”payment-method”>

    <th><?php _e( ‘Payment Method:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>

    <td><?php $this->payment_method(); ?></td>

    </tr>

    <tr class=”payment-method”>

    <th><?php _e( ‘Date de règlement:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>

    <td><?php $this->order_date(); ?></td>

    </tr>

    <?php do_action( ‘wpo_wcpdf_after_order_data’, $this->type, $this->order ); ?>

    </table>

    </td>

    </tr>

    </table>

    <?php do_action( ‘wpo_wcpdf_before_order_details’, $this->type, $this->order ); ?>

    <table class=”order-details”>

    <thead>

    <tr>

    <th class=”product”><?php _e(‘Désignation des produits’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>

    <th class=”quantity”><?php _e(‘Quantity’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>

    <th class=”price”><?php _e(‘Prix unitaire Hors Taxe’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>

    <th class=”total price”><?php _e(‘Prix total Hors Taxe’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>

    </tr>

    </thead>

    <tbody>

    <?php $items = $this->get_order_items(); if( sizeof( $items ) > 0 ) : foreach( $items as $item_id => $item ) : ?>

    <tr class=”<?php echo apply_filters( ‘wpo_wcpdf_item_row_class’, $item_id, $this->type, $this->order, $item_id ); ?>”>

    <td class=”product”>

    <?php $description_label = __( ‘Description’, ‘woocommerce-pdf-invoices-packing-slips’ ); // registering alternate label translation ?>

    <span class=”item-name”><?php echo $item[‘name’]; ?></span>

    <?php do_action( ‘wpo_wcpdf_before_item_meta’, $this->type, $item, $this->order ); ?>

    <span class=”item-meta”><?php echo $item[‘meta’]; ?></span>

    <dl class=”meta”>

    <?php $description_label = __( ‘SKU’, ‘woocommerce-pdf-invoices-packing-slips’ ); // registering alternate label translation ?>

    <?php if( !empty( $item[‘sku’] ) ) : ?><dt class=”sku”><?php _e( ‘SKU:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></dt><dd class=”sku”><?php echo $item[‘sku’]; ?></dd><?php endif; ?>

    <?php if( !empty( $item[‘weight’] ) ) : ?><dt class=”weight”><?php _e( ‘Weight:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></dt><dd class=”weight”><?php echo $item[‘weight’]; ?><?php echo get_option(‘woocommerce_weight_unit’); ?></dd><?php endif; ?>

    </dl>

    <?php do_action( ‘wpo_wcpdf_after_item_meta’, $this->type, $item, $this->order ); ?>

    </td>

    <td class=”quantity”><?php echo $item[‘quantity’]; ?></td>

    <td class=”price”><?php echo $item[‘order_price’]; ?></td>

    <td class=”total price”><?php echo $item[‘order_price’]; ?></td>

    </tr>

    <?php endforeach; endif; ?>

    </tbody>

    <tfoot>

    <tr class=”no-borders”>

    <td class=”no-borders”>

    <div class=”document-notes”>

    <?php do_action( ‘wpo_wcpdf_before_document_notes’, $this->type, $this->order ); ?>

    <?php if ( $this->get_document_notes() ) : ?>

    <h3><?php _e( ‘Notes’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></h3>

    <?php $this->document_notes(); ?>

    <?php endif; ?>

    <?php do_action( ‘wpo_wcpdf_after_document_notes’, $this->type, $this->order ); ?>

    </div>

    <div class=”customer-notes”>

    <?php do_action( ‘wpo_wcpdf_before_customer_notes’, $this->type, $this->order ); ?>

    <?php if ( $this->get_shipping_notes() ) : ?>

    <h3><?php _e( ‘Customer Notes’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></h3>

    <?php $this->shipping_notes(); ?>

    <?php endif; ?>

    <?php do_action( ‘wpo_wcpdf_after_customer_notes’, $this->type, $this->order ); ?>

    </div>

    </td>

    <td class=”no-borders” colspan=”3″>

    <table class=”totals”>

    <tfoot>

    <tr>

    <th class=”td” scope=”col” colspan=”3″ style=”text-align:<?php echo esc_attr( $text_align ); ?>;”>Sous-total H.T.</th>

    <td class=”td” scope=”col” style=”text-align:<?php echo $item[‘order_price’]; ?></td>
    </tr>

    <tfoot>

    <th class=”td” scope=”col” colspan=”3″ style=”text-align:<?php echo esc_attr( $text_align ); ?>;”>Montant Total H.T.</th>

    <td class=”td” scope=”col” style=”text-align:<?php echo $item[‘order_price’]; ?></td>

    </tr>

    </tfoot>

    </table>
    <br>
    TVA non applicable – article 293 B du CGI

    </tr>

    </tfoot>

    </table>

    <div class=”bottom-spacer”></div>

    <?php do_action( ‘wpo_wcpdf_after_order_details’, $this->type, $this->order ); ?>

    <?php if ( $this->get_footer() ): ?>

    <div id=”footer”>

    <!– hook available: wpo_wcpdf_before_footer –>

    <?php $this->footer(); ?>

    <!– hook available: wpo_wcpdf_after_footer –>

    </div><!– #letter-footer –>

    <?php endif; ?>

    <?php do_action( ‘wpo_wcpdf_after_document’, $this->type, $this->order ); ?>

    Thank you for your help.

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

    (@pomegranate)

    Could you add &output=html to the URL of the invoice and post the HTML source to something like pastebin.com and post a link here? This error indicates there’s some faulty HTML in your template output (dompdf is less forgiving with that than the average browser), but we can’t see that from just the PHP source.

    Thread Starter bestoffitpack

    (@bestoffitpack)

    Hello, thanks for answer. Sure : https://pastebin.com/j4V3s23Z

    Thanks.

    Plugin Contributor Ewout

    (@pomegranate)

    Thanks, that helps. There are several errors in the file (you can run it throug the w3 validator for a complete report), I think the main error is here:

    
    <td class="td" scope="col" style="text-align:<?php echo $item['order_price']; ?></td>
    
    Thread Starter bestoffitpack

    (@bestoffitpack)

    Thank you very much for the reply. But, why the error now occurs after updating WP when it always worked before and I didn’t change anything?

    Plugin Contributor Ewout

    (@pomegranate)

    I don’t know, this could have many reasons (PHP update). The HTML is quite wrong and depending on a variety of factors, it may not be a recoverable error, resulting in this error. You should always make sure that your template produces valid HTML as much as possible.

    Thread Starter bestoffitpack

    (@bestoffitpack)

    Ok thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Error following update 5.9.’ is closed to new replies.