Support » Plugin: Woo Custom Emails Per Product » BUG ON FINAL MESSAGE

  • Resolved royrogers

    (@royrogers)



    Hi there,

    I found a bug on the email final message (Completed order):

    Warning: in_array() expects parameter 2 to be array, null given in /public_html/wp-content/plugins/woo-custom-emails-per-product/includes/class-woo-custom-emails-output.php on line 78

    Thank you!

Viewing 13 replies - 16 through 28 (of 28 total)
  • Plugin Author alexmustin

    (@alexmustin)

    I’m still unable to reproduce this issue on my end.

    I just tried on a fresh WP install with:
    PHP — version 7.2.1
    WordPress — version 4.9.4
    Divi theme — version 3.0.96
    WooCommerce — version 3.3.3
    Woo Custom Emails — version 2.1.1

    I tried placing 2 new orders:

    • Simple Product
    • Variable Product

    Both of these worked just fine — I was able to assign a different Custom Message to each product and save it, and it kept my Custom Email Message settings.

    When I purchased these individually, my Custom Email Message showed up in the correct spot, in the correct Status email.
    I do not ever get an error about the array being null…

    I will look further and see if there is anything else I can do to prevent this.

    Thanks for your patience!

    • This reply was modified 5 months, 2 weeks ago by  alexmustin.
    Plugin Author alexmustin

    (@alexmustin)

    HI paulinho_rus and acevka,

    Can you please try this new Beta version and let me know if you still receive the error:

    http://alexmustin.com/upload/woo-custom-emails-per-product.2.1.2.beta.zip

    Thanks!

    hi alex, thank u so much it works.

    Now it works great, thank you Alex!

    Plugin Author alexmustin

    (@alexmustin)

    Thanks acevka and paulinho_rus!

    I’ll push this out as an official release today.

    Hi Alex.

    I’m sorry to take up this thread again… I’ve had a similar problem for a while, since one of the recent updates (I’m not sure which one, though). All plugins are updated, custom email to v. 2.1.3.

    Several errors appear in the email before the message content:
    https://snag.gy/K4ywXn.jpg
    https://snag.gy/UPhDqY.jpg

    I messed around, deactivated all plugins but Woocommerce, with the same result. BUT accidently I noticed, that one setting makes the difference: the ‘Downloadable’ setting under Woocommerce product data.
    My product is a service (tickets for tours), so I want them to be automatically accepted and the transfer activated immediately. I made that happen by activating ‘virtual’ AND ‘downloadable’, and maybe that’s not right. But as far as I can tell, if I deactivate ‘downloadable’ and approve the purchase manually, the errors don’t appear.
    I hope this can help you to find the cause of the errors.

    Thanks.

    Best regards, Asser.

    Error-message:
    Notice: Undefined variable: shown_emails in /var/www/becopenhagen.dk/public_html/wp-content/plugins/woo-custom-emails-per-product/includes/class-woo-custom-emails-output.php on line 78

    Warning: in_array() expects parameter 2 to be array, null given in /var/www/becopenhagen.dk/public_html/wp-content/plugins/woo-custom-emails-per-product/includes/class-woo-custom-emails-output.php on line 78

    and later in the email:

    Notice: Undefined variable: shown_emails in /var/www/becopenhagen.dk/public_html/wp-content/plugins/woo-custom-emails-per-product/includes/class-woo-custom-emails-output.php on line 78

    Warning: in_array() expects parameter 2 to be array, null given in /var/www/becopenhagen.dk/public_html/wp-content/plugins/woo-custom-emails-per-product/includes/class-woo-custom-emails-output.php on line 78

    Notice: Undefined variable: shown_emails in /var/www/becopenhagen.dk/public_html/wp-content/plugins/woo-custom-emails-per-product/includes/class-woo-custom-emails-output.php on line 78

    Warning: in_array() expects parameter 2 to be array, null given in /var/www/becopenhagen.dk/public_html/wp-content/plugins/woo-custom-emails-per-product/includes/class-woo-custom-emails-output.php on line 78

    Plugin Author alexmustin

    (@alexmustin)

    Hi @asser-munch,

    I’m wondering what your server setup is? I’ve tested this locally on PHP 5 and 7 and it works properly for me every time. It has worked properly on every live website I’ve installed it on as well.

    Please go to:

    • WooCommerce > Status
    • Click the “Get System Report” button
    • Copy/paste all that in an email and send to me: alex[at]alexmustin[dot]com

    Thanks!

    I have the same error in the final email if user bought a product.
    It’s a bookable product.

    
    Warning: in_array() expects parameter 2 to be array, null given in /www/htdocs/DOMAIN/wp-content/plugins/woo-custom-emails-per-product/includes/class-woo-custom-emails-output.php on line 78
    
    ### WordPress Environment ###
    
    Home URL: http://DOMAIN.com
    Site URL: http://DOMAIN.com
    WC Version: 3.3.4
    Log Directory Writable: ✔
    WP Version: 4.9.4
    WP Multisite: –
    WP Memory Limit: 512 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: de_DE
    
    ### Server Environment ###
    
    Server Info: Apache
    PHP Version: 7.1.11-nmm1
    PHP Post Max Size: 200 MB
    PHP Time Limit: 0
    PHP Max Input Vars: 3000
    cURL Version: 7.47.0
    OpenSSL/1.0.2g

    I still have the same issue. Unfortunetly is not fixed for me.

    Warning: in_array() expects parameter 2 to be array, null given in /home/declicin/public_html/wp-content/plugins/woo-custom-emails-per-product/includes/class-woo-custom-emails-output.php on line 78

    A workaround is to click on the ACTION COLUMN on the ORDERS table

    https://declicinternational.com/wp-admin/edit.php?post_type=shop_order

    instead of selecting the dropbox status “completed” on the edit page

    https://declicinternational.com/wp-admin/post.php?post=354693&action=edit

    ### Server Environment ###
    PHP version: 7.0.29

    Thanks

    • This reply was modified 4 months, 1 week ago by  royrogers.

    Hello!

    Thank you for the potentially fantastic plugin. (I had manually coded this functionality, then removed it when I found your plugin yesterday.)

    However, I’ve also been hit by this same error. Products are variable + virtual. I tested extensively content insertion via this plugin last night when checkout = cash on delivery. Worked perfectly.

    Today 2 orders were placed by customers using a live payment gateway and all the mails that were generated had this error: 2 mails to customer (order is being processed) and 2 mails to backend (new order notification). Each mail had the same warning message repeated 4 times.

    Right now again I turned on checkout = cash on delivery for a moment to test, and the mails are just perfect.

    Pls let me know what all info /screenshots / server settings / anything you need and I can provide.

    Further updates:

    1. I reproduced the issue easily with 2 payments gateways in test mode on my side: Stripe and Instamojo

    2. After looking through the file class-woo-custom-emails-output.php, it *seems* the issue is that $shown_emails is not initialized in the scope it is being used at line 78. Hence to solve that I had to pass $shown_emails to the foos

    Line 42

    public function woo_custom_emails_insert_content($shown_emails = array()) {

    Line 49

    function woo_custom_emails_output_message( $order , $shown_emails = array()){

    This has been tested with both payments gateways and cash on delivery. Working fine.

    • This reply was modified 4 months, 1 week ago by  zehawk.
    Plugin Author alexmustin

    (@alexmustin)

    Thanks for the input, @zehawk!

    This was giving me issues for quite some time and I wasn’t sure exactly how to send the array into a function.

    I’ll add this to the plugin code and release an update as soon as possible!

    Hi there,

    It seems to be fixed!

    Thanks!

Viewing 13 replies - 16 through 28 (of 28 total)
  • You must be logged in to reply to this topic.