• Resolved Flyer29

    (@flyer29)


    Hi Ewout,

    I’m experiencing some strange behavior on my live site, which are really not making sense to me. Perhaps you can point me in the right direction. The local site with the same settings is however working like a charm. Looking at the system status on the live site, “I’m green” everywhere but not for GMagic or iMagic.

    On the live site, I can’t produce pdf invoices or packing slips in the invoices view of woocommerce pressing the corresponding button. I get a blank screen without content. Using the filter to print out the html used by the pdf parser is giving me the same behavior. However I get an invoice number produced, but woocommerce doesn’t give me the pdf action invoice button under my “account”.

    The error I get in the log of the live site is making no sense to me, since I get a PHP Parse error: syntax error, unexpected ‘[‘, expecting ‘,’ or ‘;’ in xxxx/woocommerce/pdf/Aquatropica/invoice.php on line 107, referer: xxxx/wp-admin/edit.php?post_type=shop_order

    Line 107 of the file is echo $wpo_wcpdf->get_order_subtotal()[‘value’];

    Did you have this before or could you give me some hint on this one? I’m bluffed that a local site works fine but the same file gives me a syntax error when live ??

    Regards
    Pierre

    https://www.ads-software.com/plugins/woocommerce-pdf-invoices-packing-slips/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Flyer29

    (@flyer29)

    The infamous line 107 seems not to be the root cause. Looking in the browser, I see in console a 500 error for “xxx/wp-admin/admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=25381&_wpnonce=091b5a553d”.

    Plugin Contributor Ewout

    (@pomegranate)

    Hello Pierre,
    Depending on how forgiving your PHP install is configured, you cannot treat the return of a function directly as an array. Splitting it should solve the issue:

    $order_subtotal =  $wpo_wcpdf->get_order_subtotal();
    echo $order_subtotal['value']

    but you don’t need that, as this will echo directly:

    $wpo_wcpdf->order_subtotal();

    p.s. you’re scaring away other users with such topic titles ;o)

    Thread Starter Flyer29

    (@flyer29)

    Holy molly, that was the trick. Awesome!

    Btw Ewout, I was heavily tweaking the packing slip template to produce something really german that has to be put to each order to explain the people that they can give goods back if they don’t like it (if you don’t do that here you will go to jail and so on, really). Based on shipping class you can then per item offer (or not) a return.

    Since you helped me that much and that quick, I was thinking about sending you the template, so you could look at it and decide to offer (or not ) this kind of packing slip as a premium template. Is it a way for me to send you the pdf sample and the php file I made with a lot of love?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘syntax error on live site’ is closed to new replies.