Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#48711 closed defect (bug) (invalid)

PHP Notice: Undefined index: before_widget - ELEMENTOR

Reported by: carmen28moreno's profile carmen28moreno Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords:
Focuses: Cc:

Description

Since I install elementor, I'm having the following errors in my debug.log:

[18-Nov-2019 20:09:04 UTC] PHP Notice: Undefined index: before_widget in /var/www/wp-content/plugins/themeisle-companion/vendor/codeinwp/elementor-extra-widgets/widgets/woo/best-products.php on line 77
[18-Nov-2019 20:09:04 UTC] PHP Notice: Undefined index: after_widget in /var/www/wp-content/plugins/themeisle-companion/vendor/codeinwp/elementor-extra-widgets/widgets/woo/best-products.php on line 93
[18-Nov-2019 20:09:04 UTC] PHP Notice: Undefined index: widget_id in /var/www/wp-content/plugins/themeisle-companion/vendor/codeinwp/elementor-extra-widgets/widgets/woo/best-products.php on line 96

When having this error, a momentaneous error message 503 appears and my page is down.
Here are the lines of code referenced by the error (the bold ones).

public function widget( $args, $instance ) {
		$cache = array();
		if ( ! $this->is_preview() ) {
			$cache = wp_cache_get( 'woo_best_products', 'widget' );
		}

		if ( ! is_array( $cache ) ) {
			$cache = array();
		}

		if ( ! isset( $args['widget_id'] ) ) {
			$args['widget_id'] = $this->id;
		}

		if ( isset( $cache[ $args['widget_id'] ] ) ) {
			echo $cache[ $args['widget_id'] ];

			return;
		}

		ob_start();

		$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );

		if ( '' == $title ) {
			$title = __( 'Best Sellers', 'themeisle-companion' );
		}

		$limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
		if ( '' == $limit ) {
			$limit = 4;
		}
		$columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;

		if ( '' == $columns ) {
			$columns = 4;
		}

		$args = apply_filters(
			'elementor-addon-widgets_product_categories_args', array(
				'limit'   => $limit,
				'columns' => $columns,
				'title'   => $title,
				'orderby' => 'date',
				'order'   => 'desc',
			)
		);
77---->		echo $args['before_widget'];
		echo '<section class="eaw-product-section woo-best-products">';

		do_action( 'storepage_homepage_before_best_selling_products' );
		echo '<h2 class="section-title">' . wp_kses_post( $args['title'] ) . '</h2>';

		do_action( 'storepage_homepage_after_best_selling_products_title' );
		echo $this->do_shortcode(
			'best_selling_products', array(
				'per_page' => intval( $args['limit'] ),
				'columns'  => intval( $args['columns'] ),
			)
		);
		do_action( 'storepage_homepage_after_best_selling_products' );

		echo '</section>';
93---->		echo $args['after_widget'];

		if ( ! $this->is_preview() ) {
96---->			$cache[ $args['widget_id'] ] = ob_get_flush();
			wp_cache_set( 'woo_best_products', $cache, 'widget' );
		} else {
			ob_end_flush();
		}
	}

Change History (3)

#1 @carmen28moreno
5 years ago

  • Summary changed from PHP Notice: Undefined index: before_widget to PHP Notice: Undefined index: before_widget - ELEMENTOR

#2 @carmen28moreno
5 years ago

In the main page I am using that 'elementor extra widget' called best-products, so it could be the root of the problem. I am very grateful for you to help me, I'm desperate because of this Error 503.

#3 @peterwilsoncc
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

@carmen28moreno

Hello and welcome to trac!

Trac is used to develop the WordPress core software and the content from your debug.log suggests the issue is either from the Elementor theme or WooCommerce.

As there's no expertise here for either the theme or plugin, I suggest you content their relative support channels via https://woocommerce.com/contact-us/ or https://elementor.com/support/. Otherwise you may find some knowledgable people in the WordPress support forums at wordpress.org/support.

I've closed this ticket as invalid, which in this case is tracs unfriendly way of saying that you've been referred to other support channels.

Peter

Note: See TracTickets for help on using tickets.