• alx359

    (@alx359)


    Each time when saving a WC product, I’m getting the following notice:

    `PHP Notice: Undefined index: enable_payment_action in \plugins\paypal-for-woocommerce\paypal-for-woocommerce.php on line 1117

    line 1117:
    if ( 'yes' === $_REQUEST['enable_payment_action'] ) {
    adjusting it to:
    if ( isset($_REQUEST['enable_payment_action']) && ('yes' === $_REQUEST['enable_payment_action']) ) {
    makes the notice go away for me

    Thanks.

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

    (@angelleyesupport)

    Hi @alx359,

    Is that happening on any new product, every new product or updating products?

    Thanks!

    Thread Starter alx359

    (@alx359)

    When updating products. Just opening and hitting save.

    Checked the enable_payment_action column is there but all empty.

    Plugin Contributor angelleyesupport

    (@angelleyesupport)

    Hi @alx359,

    Thanks for letting me know, but my experience with the plugin / that option is not same like yours. Just tested it using PP for woo 1.5.3 branch , make Enable Payment Action checked and hit save. That all went well without any trouble.

    So, I’m reached at a point that either its a woo conflict, theme or PHP version.
    I’m testing it with default WP theme, PHP 7.1 and woo latest version.
    Could you check with those same parameters please and let me know?
    Thanks!

    Thread Starter alx359

    (@alx359)

    Meant the enable_payment_action column is all empty in the database (for all products), when looking at it with myphpadmin.

    Checking that option in the backend for a given product makes the notice go away. Unchecking it/leaving it blank and the notice reappears.

    Just tested with the Health Check plugin in troubleshooting mode (latest WP with 2017 theme, WC latest, PP for WC latest, WAMP/PHP7.1), and the issue still persists my end.

    Thanks.

    Plugin Contributor angelleye

    (@angelleye)

    @alx359, Please go to Settings -> PayPal for WooCommerce -> Tools Tab. There will find our Bulk Edit Tool for Products.

    From the Action drop-down, choose Disable Payment Action, and then for Target set All Products.

    When you run that it will effectively set the database with a value for “disable”, and this should eliminate the PHP notice you’re seeing.

    At that point, if you did need to specifically adjust that value for any product(s), you could do so accordingly.

    Thread Starter alx359

    (@alx359)

    Thanks for the tip, Angell. It isn’t working quite as intended though.

    The bulk tool is writing 'no' to the DB for all products, when using ‘Disable Payment Action’ dropdown as suggested.

    However, the WC product page is writing '' to the DB when hitting ‘update’ and the ‘Enable Payment Action’ checkbox isn’t checked. The Undefined index: enable_payment_action notice is still appearing my end.

    Looking at the code on line 1120 suggests of why; the enable_payment_action field in the DB is being updated with '', not with 'no'

    public function angelleye_paypal_for_woo_product_process_product_meta($post_id) {
        if ( 'yes' === $_REQUEST['enable_payment_action'] ) {
            update_post_meta( $post_id, 'enable_payment_action', 'yes' );
        } else {
            update_post_meta( $post_id, 'enable_payment_action', '' );
        }

    Changing the update line above from '' to 'no' updates the DB correctly this time, but isn’t making the PHP notice go away though.

    Plugin Contributor angelleyesupport

    (@angelleyesupport)

    Hi Alex,

    We will look into this and make necessary adjustments accordingly.

    Thanks!

    Thread Starter alx359

    (@alx359)

    Mind I’m with define('WP_DEBUG', true);

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘‘Undefined index’ during WC product save’ is closed to new replies.