Jump to content

Constant errors, Invalid product vars at line 108 in file classes/Link.php


Recommended Posts

I have checked the log file on my sites and they have regular error logs virtually every day with this same message,

 

*ERROR* 2013/08/30 - 21:06:20: Invalid product vars at line 108 in file classes/Link.php

 

 

Below is the relevant snippet from Link.php

 

100   	 if (!is_object($product))
102   	 {
103	   	 if (is_array($product) && isset($product['id_product']))
104			   	 $product = new Product($product['id_product'], false, $id_lang);
105		   else if (is_numeric($product) || !$product)
106			   $product = new Product($product, false, $id_lang);
107	   	 else
108		   	 throw new PrestaShopException('Invalid product vars');
109   	 }

 

Any suggestions on the cause of these errors?

Steve

Link to comment
Share on other sites

  • 3 months later...
  • 8 months later...

change

else if (is_numeric($product) || !$product)
to

elseif ((int)$product)

 

I got the same problem after updating a product today, but in my case this fix really exist in classes/link.php, what can I do?:

98. 			if (is_array($product) && isset($product['id_product']))
99. 				$product = new Product($product['id_product'], false, $id_lang, $id_shop);
100. 			elseif ((int)$product)
101. 				$product = new Product((int)$product, false, $id_lang, $id_shop);
102. 			else
103. 				throw new PrestaShopException('Invalid product vars');
104. 		}
105. 
106. 		// Set available keywords
107. 		$params = array();
108. 		$params['id'] = $product->id;

Any idea?

 

Using 1.5.6.1

Edited by Alberto Fernández (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...
  • 2 months later...
  • 1 month later...
  • 2 months later...
  • 1 month later...
  • 4 weeks later...
  • 1 month later...
  • 11 months later...

Constant errors, Invalid product vars at line 108 in file classes/Link.php [PrestaShopException]

Invalid product vars

at line 106 in file classes/Link.php

101. if (is_array($product) && isset($product['id_product'])) {

102. $product = new Product($product['id_product'], false, $id_lang, $id_shop);

103. } elseif ((int)$product) {

104. $product = new Product((int)$product, false, $id_lang, $id_shop);

105. } else {

106. throw new PrestaShopException('Invalid product vars');

107. }

108. }

109.

110. // Set available keywords

111. $params = array();

Link to comment
Share on other sites

  • 6 months later...

I had the same problem...

If the Cross-selling module is deactivated, you must disable the "Show cross-selling" option in the BlockCart module!

 

By doing this, on my site the bug has disappeared.

  • Thanks 2
Link to comment
Share on other sites

×
×
  • Create New...