Jump to content

Product Reviews Module error


Recommended Posts

Hello,
 
I have a big problem with the default Product Reviews module (v 3.5.1), even if I press Uninstall i get this error:
 
I did set the ('_PS_MODE_DEV_', true) to see this error , otherwise it's just a blank page
 
Notice: Trying to get property of non-object in /home/psboxro/public_html/classes/controller/FrontController.php on line 291

Fatal error: Call to a member function isLogged() on a non-object in /home/psboxro/public_html/classes/controller/FrontController.php on line 464
 
From BO when I click "Product reviews" I get the same error.
 
I manually deleted the module, and from BO when I click Install ... again with the error.

 

 

 

Prestashop ver. 1.6.1.0

Edited by DreadBv (see edit history)
Link to comment
Share on other sites

  • 5 weeks later...

What version of PrestaShop and Product Reviews module are you using?

From the error it looks like there is something weird with a customer.

You might have some corrupted data to one or more customers.

Have you deleted any accounts lately? Are there any comments from a customer that isn't available in your store anymore?

Link to comment
Share on other sites

Hi gabdabara, i use version 1.6.1.1, this is error edit or uninstalling module

"Notice: Trying to get property of non-object in /classes/controller/FrontController.php on line 291

Fatal error: Call to a member function isLogged() on a non-object in /classes/controller/FrontController.php on line 457"

 

yes we deleted many test accounts

 

Best regards

 

pd sory my english

Link to comment
Share on other sites

Wow, there is no way to add code that does not exist if the customer does not take into account and ignore the error?

 

Not sure if it will work, but you could try the following changes.

 

https://github.com/PrestaShop/PrestaShop/blob/1.6.1.1/classes/controller/FrontController.php#L291

Change into:

if (isset($_GET['logout']) || (Validate::isLoadedObject($this->context->customer) && $this->context->customer->logged && Customer::isBanned($this->context->customer->id))) {

https://github.com/PrestaShop/PrestaShop/blob/1.6.1.1/classes/controller/FrontController.php#L295

Change into:

} elseif (isset($_GET['mylogout']) && Validate::isLoadedObject($this->context->customer)) {

https://github.com/PrestaShop/PrestaShop/blob/1.6.1.1/classes/controller/FrontController.php#L457

Change into:

'is_logged'           => Validate::isLoadedObject($this->context->customer) && $this->context->customer->isLogged(),
Link to comment
Share on other sites

  • 4 weeks later...

If you still have this problem you could try to adjust it in the same manner as the previous changes.

 

https://github.com/PrestaShop/PrestaShop/blob/1.6.1.1/classes/controller/FrontController.php#L458

Change into:

'is_guest'            => Validate::isLoadedObject($this->context->customer) && (bool)$this->context->customer->isGuest(),

Basically, what all this changes do is before using a customer function it verifies if the customer really exists.

If you can't find a way to eliminate junk customer data from database, then that validation should be placed everywhere you encounter a customer php error.

Link to comment
Share on other sites

  • 1 month later...

Hey joseangel2003,

 

how did you solve the problem?

 

If I modify the code gabdara mentioned, I run into hundreds of code pieces I have to change into "Validate::siLoadedObject..."

That is not a good solution for updates.

 

Thanks for a reply!

 

EDIT:

 

Found the problem by deactivating all overrides.

So it must be an additional module installed, in my case "prettyurls".

 

In the Dispatcher.php / Line 458 change:

if (preg_match('/\?/', $this->request_uri) && preg_match('/productcomments/', $this->request_uri))

to:

if (preg_match('/\?/', $this->request_uri) && preg_match('/productcomments/', $this->request_uri) && ($controller != 'AdminModules') )

Explanation:

 

The Backoffice-URL to configure the module contains also the segment "productcomments" like in frontoffice.

so prettyurl sets the $controller = "default" in the if-statement

-> This breaks up Prestashop

 

The developer of this module is informed.

 

Cheers André

Edited by andre.presta (see edit history)
Link to comment
Share on other sites

  • 9 months later...

I upgrade prestashop 1.6.0.1 t0 1.6.1.9 and I got
Notice: Trying to get property of non-object in /var/www/html/projects/nettesokken-upgraded/classes/controller/FrontController.php on line 291

Fatal error: Call to a member function isLogged() on a non-object in /var/www/html/projects/nettesokken-upgraded/classes/controller/FrontController.php on line 457

 

But as I install fresh prestashop 1.6.1.9 on seperate folder it is working fine without error.

 

 

I am using prestashop 1.6.1.9 and product comment version 3.5.2

Edited by Anant Thakur (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...