The professional approach to add value to your customer offers.

Support


New : Whether it’s a plugin thats causing issues, a theme, or just needed help with styling your site or WPUSPSC…We can help! Live Support for all your WordPress or Prestashop needs! Support provided by Ultra Prod Staff.

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: "Undefined index" errors
andpet
Newbie
Posts: 1
Permalink
Post "Undefined index" errors
on: July 19, 2012, 11:01
Quote

Hi
I installed the paypal cart 4.3.3 to Wordpress 3.4.1.

I immediately got these errors printed at the top of every page:

Notice: Undefined index: addcart in /var/www/web/wse64536/kiwiembedded.com/wp/wp-content/plugins/wp-ultra-simple-paypal-shopping-cart/wp_ultra_simple_shopping_cart.php on line 86

Notice: Undefined index: quantity in /var/www/web/wse64536/kiwiembedded.com/wp/wp-content/plugins/wp-ultra-simple-paypal-shopping-cart/wp_ultra_simple_shopping_cart.php on line 133

Notice: Undefined index: delcart in /var/www/web/wse64536/kiwiembedded.com/wp/wp-content/plugins/wp-ultra-simple-paypal-shopping-cart/wp_ultra_simple_shopping_cart.php on line 146

When I add 'add to cart' button I get even more errors.

Notice: Undefined variable: post in /var/www/web/wse64536/kiwiembedded.com/wp/wp-content/plugins/wp-ultra-simple-paypal-shopping-cart/wp_ultra_simple_shopping_cart.php on line 537

Notice: Trying to get property of non-object in /var/www/web/wse64536/kiwiembedded.com/wp/wp-content/plugins/wp-ultra-simple-paypal-shopping-cart/wp_ultra_simple_shopping_cart.php on line 537

Notice: Undefined index: 1 in /var/www/web/wse64536/kiwiembedded.com/wp/wp-content/plugins/wp-ultra-simple-paypal-shopping-cart/wp_ultra_simple_shopping_cart.php on line 486

Suggestion?

Mophilly
Newbie
Posts: 9
Permalink
Post Re: "Undefined index" errors
on: August 28, 2012, 13:32
Quote

There is approximately 25 places in the code that will raise these notices. Note that these are not fatal errors, just warnings. Disabling the PHP error reporting will suppress the notices.

In my case, I am developing a companion plugin and I need the error display enabled. So I worked my way through the code and resolved each notice. For example, here is one fix to the undefined index on line 87 raised when the plugin is activated.

	// 08/21/12 mophilly; step around empty $post
	if (empty($post)) {
		$permlink = '';
	} else {
		$permlink = get_permalink($post->ID);
	}

I hope this helps.

mcd
Administrator
Posts: 358
Permalink
Post Re: "Undefined index" errors
on: October 1, 2012, 13:02
Quote

Thanks Mophilly,

I add your permlink test to avoid notice on get_permlink.
For other notice I'm not perfect, maybe one day i will code without any ;-) , but now I'm more focused on error.

Mike

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.028 seconds.

New : Whether it’s a plugin thats causing issues, a theme, or just needed help with styling your site or WPUSPSC…We can help! Live Support for all your WordPress or Prestashop needs! Support provided by Ultra Prod Staff.