• Resolved mahi38

    (@mahi38)


    Hi,

    I made a customized template.
    After upgrading WooCommerce PDF Invoices & Packing Slips to 1.6.5 and WooCommerce to 3.0.4 I have a line code that makes the PDF generation crash.
    The code should print the thumbnail of a product.

    <td class="thumbnail">
    <?php
       $_product = $wpo_wcpdf->export->order->get_product_from_item( $item );
       if ($item['product_id'] > 0) {
          echo $_product->get_image( array(30, 50) ) . "<br>"; // does not work anymore
       }
    ?>
    </td>

    I substitute $wpo_wcpdf->export with WPO_WCPDF()->export but it does not solve the issue.

    What do I miss ?

    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Something went wrong during one of the last updates.
    I always had Thumbnail showing in WC PDF but its gone after latest update.

    Im setting back the previous version (working).
    Tell me if you want the previous version where the thumbnail is actually working.

    Thread Starter mahi38

    (@mahi38)

    Yes please, send me an update

    thanks a lot

    It is not a Upgrade, its a Downgrade.
    The Downgrade will allow you to use image thumbnails in the PDF.

    Place “custompdf” folder in “/wp-content/themes/your-child-theme/woocommerce/pdf/”

    Then, replace the folder “/wp-content/plugins/woocommerce-pdf-invoices-packing-slips” with the folder “woocommerce-pdf-invoices-packing-slips”.

    https://mega.nz/#!RB5nWLZQ!fCFVoA00o47q0_jwElOsgbpJIxDMZaPZYjOLqo6p9XI

    • This reply was modified 8 years, 11 months ago by boutzamat. Reason: Forgot the URL to the plugin :P
    Plugin Contributor Ewout

    (@pomegranate)

    I would certainly not recommend that. You don’t need to use any custom code for this. First of all it’s important to note that $item is not the WooCommerce item but the PDF item. The WooCommerce item is under $item['item']. The product object is already loaded under $item['product'] and the thumbnail (img tag) as $item['thumnail'].

    Hope that helps! If you want to avoid things like this, the Premium Templates come with a customizer that will let you add any columns (including the thumbnail) with a simple drag & drop interface, no coding required.

    Hope that helps!
    Ewout

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘code for thumbnail print’ is closed to new replies.