• Resolved vickygr89

    (@vickygr89)


    Hi, I am trying to display a table press into my invoice/pdf. I have used the shortcode and the PHP code tablepress_print_table_info( “id=1&field=name” );
    Every time I do that the pdf gets broken
    how can I add this to the invoice.php file?
    thanks

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

    (@pomegranate)

    shortcodes are not parsed inside the invoice, but if you have a custom template with the above PHP code it should be able to output. Where exactly did you put this and what is the current output? You can do two things to debug this:

    1) add &debug=true to the URL of the invoice to see what error is breaking the PDF
    2) add &output=html to the URL to see the HTML that is used to generate the PDF. This may display correctly in your browser, but it is important that this is 100% valid HTML, you could check this in the W3 validator for example.

    Let us know you find!

    Thread Starter vickygr89

    (@vickygr89)

    hello, thanks for the answer. I added the code in invoice.php under my custom template in my child theme.
    do you guys have a filter or action to load this php code before ajax load?
    thanks

    Plugin Contributor Ewout

    (@pomegranate)

    I’m not sure I understand what you mean by this:

    load this php code before ajax load

    Could you elaborate a little?

    Did adding the URL parameters yield anything that helps identify the root cause?

    Thread Starter vickygr89

    (@vickygr89)

    I get “Error creating PDF, please contact the site owner”

    Thread Starter vickygr89

    (@vickygr89)

    I got it working with this code.

    wpo_wcpdf_custom_text ();
    function wpo_wcpdf_custom_text () {
    TablePress::$controller = TablePress::load_controller( ‘frontend’ );
    TablePress::$controller->init_shortcodes();
    $content = tablepress_get_table( array(
    ‘id’ => ‘4’,
    ‘hide_columns’ => ‘3,4,5,6,7’
    ) );
    echo $content;
    }

    Plugin Contributor Ewout

    (@pomegranate)

    Error creating PDF, please contact the site owner

    is a frontend error (my account), you can only see debug information if you open the PDF as an admin.
    Glad to hear that resolves the issue though, all the best with your site!

    Thread Starter vickygr89

    (@vickygr89)

    thanks

    Hi,

    great! Good to hear that you found a solution! ??

    Best wishes,
    Tobias

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Add Table Press into WooCommerce PDF Invoices & Packing Slips’ is closed to new replies.