Support » Plugin: WOOF - Products Filter for WooCommerce » PHP Warnings in error log

  • Resolved chemistrap1

    (@chemistrap1)


    Hello, when i try to filter it create lines in error log.
    it says:
    PHP Warning: Invalid argument supplied for foreach() in ../../woocommerce-products-filter/index.php on line 2276

    And when i check that line

     //var_dump($key_array);
                    foreach ($this->settings['meta_filter'] as $item) {
                        $key = $item['search_view'] . "_" . $item['meta_key'];
                        if (in_array($key,array_keys($get_array))) {
                            $hide_products=false;
                        }
                    }
                }

    Could you please help me?
    Thnx

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello

    Please change this code:

    if(!isset($this->settings['meta_filter']) OR !is_array($this->settings['meta_filter'])){
    $this->settings['meta_filter']=array();
    }

    Paste it here – https://c2n.me/42VLi2O.png

    Thread Starter chemistrap1

    (@chemistrap1)

    Hello,
    I added your code after
    //var_dump($key_array);

    before
    foreach ($this->settings['meta_filter'] as $item) {

    and tried again filter and check the log file but still same error appeared.

    Hello

    Ok! Try to add:

    if(!is_array($this->settings['meta_filter'])){
    $this->settings['meta_filter']=array();
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP Warnings in error log’ is closed to new replies.