Support » Plugin: WooCommerce PDF Invoices & Packing Slips » failed to open stream

  • Resolved AnuVi

    (@anuvi)


    Won’t attach invoice to logged customer. Re-installed plugin, but it still doesn’t work.

    PHP Warning:
    file_put_contents(/home5/whatever/public_html/whaterver2/wp-content/uploads/wpo_wcpdf/attachments/): failed to open stream: Is a directory in /home5/whatever/public_html/whatever2/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-main.php on line 99

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ewout

    (@pomegranate)

    Are you using any filters to change the filename or have you made any other modifications? This appears to be trying to save a file without a filename.

    Oh, thanks for the tip! It works if I comment out this filter:

    //change pdf-name
    add_filter( ‘wpo_wcpdf_filename’, ‘wpo_wcpdf_custom_filename’, 10, 4 );
    function wpo_wcpdf_custom_filename( $filename, $template_type, $order_ids, $context ) {
    if(get_locale()==”et”){

    $invoice_string = _n( ‘invoice’, ‘invoices’, count($order_ids), ‘woocommerce-pdf-invoices-packing-slips’ );
    $new_prefix = _n( ‘Arve’, ‘Arved’, count($order_ids), ‘woocommerce-pdf-invoices-packing-slips’ );
    $new_filename = str_replace($invoice_string, $new_prefix, $filename);

    return $new_filename;
    }

    }

    Plugin Author Ewout

    (@pomegranate)

    it’s this bit:

    
    if(get_locale()=="et"){
    

    get_locale is not reliable for backend processes (that may run separately from the actual user), I would recommend to simply use a custom translation instead.

    If you still want to use the above filter, make sure to take return $new_filename out of the if conditional (put it at the very and of the function instead) so that it returns a filename for all locales.

    Ewout

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘failed to open stream’ is closed to new replies.