Replies: 1
Hello I’m also having the issue after update. can you check my code?
I have 2 different files:
invoice.php
get_type(), $this->order ); ?> has_header_logo() ) { do_action( 'wpo_wcpdf_before_shop_logo', $this->get_type(), $this->order ); $this->header_logo(); do_action( 'wpo_wcpdf_after_shop_logo', $this->get_type(), $this->order ); } else { $this->title(); } ?> get_type(), $this->order ); ?> shop_name(); ?> get_type(), $this->order ); ?> get_type(), $this->order ); ?>
shop_address(); ?> get_type(), $this->order ); ?> get_type(), $this->order ); ?> has_header_logo() ) $this->title(); ?> get_type(), $this->order ); ?> get_type(), $this->order ); ?> billing_address(); ?> get_type(), $this->order ); ?> settings['display_email'] ) ) : ?>
billing_email(); ?> settings['display_phone'] ) ) : ?>
billing_phone(); ?> show_shipping_address() ) : ?> get_type(), $this->order ); ?> shipping_address(); ?> get_type(), $this->order ); ?> settings['display_phone'] ) ) : ?>
shipping_phone(); ?> get_type(), $this->order ); ?> settings['display_number'] ) ) : ?> settings['display_date'] ) ) : ?> get_payment_method() ) : ?> get_type(), $this->order ); ?> get_number_title(); ?> invoice_number(); ?> get_date_title(); ?> invoice_date(); ?> order_number(); ?> order_date(); ?> get_type(), $this->order ); ?> get_order_items() as $item_id => $item ) : ?> get_type(), $item, $this->order ); ?> get_type(), $item, $this->order ); ?>
get_type(), $this->order ); ?> get_document_notes() ) : ?>
document_notes(); ?> get_type(), $this->order ); ?>
get_type(), $this->order ); ?> get_shipping_notes() ) : ?>
shipping_notes(); ?> get_type(), $this->order ); ?> get_woocommerce_totals() as $key => $total ) : ?> get_type(), $this->order ); ?> get_footer() ) : ?>
footer(); ?> get_type(), $this->order ); ?>
and packing-slip.php
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<?php do_action( 'wpo_wcpdf_before_document', $this->get_type(), $this->order ); ?>
<table class="head container">
<tr>
<td class="header">
<?php
if ( $this->has_header_logo() ) {
do_action( 'wpo_wcpdf_before_shop_logo', $this->get_type(), $this->order );
$this->header_logo();
do_action( 'wpo_wcpdf_after_shop_logo', $this->get_type(), $this->order );
} else {
$this->title();
}
?>
</td>
<td class="shop-info">
<?php do_action( 'wpo_wcpdf_before_shop_name', $this->get_type(), $this->order ); ?>
<div class="shop-name"><h3><?php $this->shop_name(); ?></h3></div>
<?php do_action( 'wpo_wcpdf_after_shop_name', $this->get_type(), $this->order ); ?>
<?php do_action( 'wpo_wcpdf_before_shop_address', $this->get_type(), $this->order ); ?>
<div class="shop-address"><?php $this->shop_address(); ?></div>
<?php do_action( 'wpo_wcpdf_after_shop_address', $this->get_type(), $this->order ); ?>
</td>
</tr>
</table>
<?php do_action( 'wpo_wcpdf_before_document_label', $this->get_type(), $this->order ); ?>
<h1 class="document-type-label">
<?php if ( $this->has_header_logo() ) $this->title(); ?>
</h1>
<?php do_action( 'wpo_wcpdf_after_document_label', $this->get_type(), $this->order ); ?>
<table class="order-data-addresses">
<tr>
<td class="address shipping-address">
<!-- <h3><?php _e( 'Shipping Address:', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3> -->
<?php do_action( 'wpo_wcpdf_before_shipping_address', $this->get_type(), $this->order ); ?>
<?php $this->shipping_address(); ?>
<?php do_action( 'wpo_wcpdf_after_shipping_address', $this->get_type(), $this->order ); ?>
<?php if ( isset( $this->settings['display_email'] ) ) : ?>
<div class="billing-email"><?php $this->billing_email(); ?></div>
<?php endif; ?>
<?php if ( isset( $this->settings['display_phone'] ) ) : ?>
<div class="shipping-phone"><?php $this->shipping_phone( ! $this->show_billing_address() ); ?></div>
<?php endif; ?>
</td>
<td class="address billing-address">
<?php if ( $this->show_billing_address() ) : ?>
<h3><?php _e( 'Billing Address:', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3>
<?php do_action( 'wpo_wcpdf_before_billing_address', $this->get_type(), $this->order ); ?>
<?php $this->billing_address(); ?>
<?php do_action( 'wpo_wcpdf_after_billing_address', $this->get_type(), $this->order ); ?>
<?php if ( isset( $this->settings['display_phone'] ) && ! empty( $this->get_billing_phone() ) ) : ?>
<div class="billing-phone"><?php $this->billing_phone(); ?></div>
<?php endif; ?>
<?php endif; ?>
</td>
<td class="order-data">
<table>
<?php do_action( 'wpo_wcpdf_before_order_data', $this->get_type(), $this->order ); ?>
<tr class="order-number">
<th><?php _e( 'Order Number:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<td><?php $this->order_number(); ?></td>
</tr>
<tr class="order-date">
<th><?php _e( 'Order Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<td><?php $this->order_date(); ?></td>
</tr>
<?php if ( $shipping_method = $this->get_shipping_method() ) : ?>
<tr class="shipping-method">
<th><?php _e( 'Shipping Method:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<td><?php echo $shipping_method; ?></td>
</tr>
<?php endif; ?>
<?php do_action( 'wpo_wcpdf_after_order_data', $this->get_type(), $this->order ); ?>
</table>
</td>
</tr>
</table>
<?php do_action( 'wpo_wcpdf_before_order_details', $this->get_type(), $this->order ); ?>
<table class="order-details">
<thead>
<tr>
<th class="ref"><?php _e( 'Referencia', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<th class="description"><?php _e( 'Descprición', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<th class="quantity"><?php _e( 'Cantidad', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
<th class="weight"><?php _e( 'Peso', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ( $this->get_order_items() as $item_id => $item ) : ?>
<tr class="<?php echo apply_filters( 'wpo_wcpdf_item_row_class', 'item-'.$item_id, esc_attr( $this->get_type() ), $this->order, $item_id ); ?>">
<td class="ref">
<?php if ( ! empty( $item['sku'] ) ) : ?><dd class="sku"><?php echo esc_attr( $item['sku'] ); ?></dd><?php endif; ?>
</td>
<td class="description">
<?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->get_type(), $item, $this->order ); ?>
<?php do_action( 'wpo_wcpdf_after_item_meta', $this->get_type(), $item, $this->order ); ?>
</td>
<td class="quantity"><?php
// Get the product ID
$product_id = $item['product_id'];
// Get the product object
$product = wc_get_product( $product_id );
// Get the product metadata
$sacos = $product->get_meta( 'numero_de_sacos' );
$quantity = $item['quantity'];
if (is_numeric($sacos) && is_numeric($quantity)) {
echo $sacos * $quantity;
} else {
$message="Valores no numericos: producto".$item_name = $item['name'].': sacos'.$sacos." - cantidad:".$quantity;
error_log($message, E_USER_WARNING);
echo $quantity;
} ?></td>
<td class="weight"><?php
$peso = $item['weight']; //$product->get_weight();
$quantity = $item['quantity'];
if (is_numeric($peso) && is_numeric($quantity)) {
echo $peso * $quantity;
} else {
$message="Valores no numericos, producto".$item_name = $item['name'].': peso:'.$peso."- cantidad:".$quantity;
error_log($message, E_USER_WARNING);
echo $message;
}
?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="bottom-spacer"></div>
<?php do_action( 'wpo_wcpdf_after_order_details', $this->get_type(), $this->order ); ?>
<?php do_action( 'wpo_wcpdf_before_customer_notes', $this->get_type(), $this->order ); ?>
<div class="customer-notes">
<?php if ( $this->get_shipping_notes() ) : ?>
<h3><?php _e( 'Customer Notes', 'woocommerce-pdf-invoices-packing-slips' ); ?></h3>
<?php $this->shipping_notes(); ?>
<?php endif; ?>
</div>
<?php do_action( 'wpo_wcpdf_after_customer_notes', $this->get_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->get_type(), $this->order ); ?>