• Resolved Hunchback

    (@hunchback)


    Hello,

    I’ve been using your plugin on our site for a while, and everything was fine. Today, for a reason i fail to find it stopped working – when you click on the button to generate a PDF it opens a blank window with a url like this: http://dobiart.fr/wp-admin/admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=2634&_wpnonce=7f3f14e008

    I haven’t updated anything recently, or changed any settings. I know this sounds silly, but i really don’t see what could have caused that.

    If this can help, the “WooCommerce Sequential Order Numbers” plugin apparently stopped working at the same time, it won’t generate a new order ID for new orders. Finally, a completed order won’t update the stock levels.

    This is all quite weird since as i said, there have been no plugin updates lately, no modifications to the code or anything…

    I checked through the forum here and i did the following based on other threads:

    1. Check the write permissions for the plugin folder
    2. Change the logo for the PDF file to a small file.

    Didn’t work…

    Any ideas?

    Thanks

    https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/

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

    (@pomegranate)

    If you say some other plugins stopped working, I don’t think looking into this plugin specifically will help you. It could be a memory/server issue. Are you running other sites on the same server/is this on a shared hosting?

    If you enable WP_DEBUG, you should get an error instead of the blank page when you try to generate the PDF. If not, try outputting to HTML. See this post for more information.

    Thread Starter Hunchback

    (@hunchback)

    Hey,

    The HTML generated is simply this:

    <html>
    <head></head>
    <body>
    </body>
    </html>

    The debug gave me back this:

    Fatal error: Cannot redeclare build_url() (previously declared in /mnt/web7/c1/04/54024604/htdocs/WordPress_01/wp-content/themes/zonda/lib/widgets/facebook-like-widget.php:304) in /mnt/web7/c1/04/54024604/htdocs/WordPress_01/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/lib/dompdf/include/functions.inc.php on line 170

    Edit:
    Here’s the code from the widget.php

    function build_url($url_data) {
    $url=””;
    if (isset($url_data[‘host’])) {
    $url .= $url_data[‘scheme’] . ‘://’;
    if (isset($url_data[‘user’])) {
    $url .= $url_data[‘user’];
    if (isset($url_data[‘pass’]))
    $url .= ‘:’ . $url_data[‘pass’];
    $url .= ‘@’;
    }
    $url .= $url_data[‘host’];
    if (isset($url_data[‘port’]))
    $url .= ‘:’ . $url_data[‘port’];
    }
    if (isset($url_data[‘path’]))
    $url .= $url_data[‘path’];
    if (isset($url_data[‘query’]))
    $url .= ‘?’ . $url_data[‘query’];
    if (isset($url_data[‘fragment’]))
    $url .= ‘#’ . $url_data[‘fragment’];

    return $url;

    ———–

    Thread Starter Hunchback

    (@hunchback)

    Update:

    I commented out that section of the code in the widget, since it’s not even a widget that we are using. The PDF generated correctly.

    I am not sure if this is a solution tho, since the problem must have appeared when we last update the theme and we somehow didn’t notice it. Perhaps no PDF Invoices have been generated lately, can’t say since i am not running the shop itself, i am doing the technical part of it.

    Could you explain what’s wrong, and if there’s another way to fix this?

    Plugin Contributor Ewout

    (@pomegranate)

    Alright, glad to hear you were able to fix that.

    It looks like that widget is using the same function name as one in the PDF engine. There’s no easy way to fix this, but if you’re not using the widget, it’s probably best to disable it like you did.

    You can check if PDF invoices by enabling the invoice number column in the PDF invoice plugin settings. If an order has an invoice number, it means an invoice was created for that order.

    Thread Starter Hunchback

    (@hunchback)

    I see…
    I am a systems and networks engineer so i only know basic code really…

    What bothers me with this solution is that the next time i update the theme it will probably break again, since this widget comes with the theme. I tried deleting the widget .php file altogether, but then there’s another error produced, cause the theme is looking for the widget and fails to find it.

    Is there no way to get your plugin and that widget work with a warning instead of a critical error?

    I’ll report that to the theme author too, so that he knows.

    Plugin Contributor Ewout

    (@pomegranate)

    There would be another way if it wasn’t the PDF engine that was causing the issue. This is a public librabry that I use (dompdf), and I cannot make any changes like that for the same reason: it would break again on updates. It’s good practice to wrap all functions in classes (like I do in my plugin too). Another possibility is to do a function_exists before adding the function. My advice to the theme author would be to do the first (wrap everything in a class).

    Hi,
    I have the same fatal error.

    Fatal error: Cannot redeclare build_url() (previously declared in /homepages/1/d284977028/htdocs/clickandbuilds/WordPress/MyCMS/wp-content/themes/venedor/inc/functions.php:398) in /homepages/1/d284977028/htdocs/clickandbuilds/WordPress/MyCMS/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/lib/dompdf/include/functions.inc.php on line 170

    How can i wrap the plugin in a class?
    Thanks!

    Plugin Contributor Ewout

    (@pomegranate)

    Hellio Alemitta,
    The plugin is already wrapped in a class, the PDF engine is not. Unfortunately this is not something I can help you with right now.
    My advice is to contact the theme author(s) about this issue and ask if it’s possible for them to use a less generic function name or to wrap the theme in a class. Wrapping the theme in a class is not something that you can easily do yourself unless you’re a coder.

    Kind regards,
    Ewout

    Hi Ewout,

    Thanks for you reply.

    I tried contact with the theme author but i didnt had answer.

    Are there other form to solve this problem?

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

The topic ‘Plugin suddenly stopped working’ is closed to new replies.