Jump to content

Blockcustomerprivacy Update Gives Fatal Error Issue


Recommended Posts

I just updated customer privacy block and now I get this error when I click on Module in back office.

I cannot access Module anymore.

I am on version 1.6.1.1 with default-bootstrap theme. 

Anyone else having same issue and solved, please share.

Thank you in advance.

 

Fatal error: Using $this when not in object context in /home/cnpark70/public_html/modules/blockcustomerprivacy/upgrade/install-2.0.0.php on line 10
[PrestaShop] Fatal error in module file :/home/cnpark70/public_html/modules/blockcustomerprivacy/upgrade/install-2.0.0.php:
Using $this when not in object context

 

And below is the content of install-2.0.0.php file that's making fatal error in line 10

 

<?php

 
if (!defined('_PS_VERSION_'))
exit;
 
function upgrade_module_2_0_0($object)
{
$return = true;
 
$return &= $this->registerHook('displayCustomerIdentityForm');
$return &= $this->unregisterHook('header');
 
$langs = Language::getLanguages(false);
$old_messages = array();
foreach ($langs as $l)
$old_messages[$l['id_lang']] = Configuration::get('CUSTPRIV_MESSAGE', $l['id_lang']);
 
Configuration::updateValue('CUSTPRIV_MESSAGE', $old_messages);
Configuration::updateValue('CUSTPRIV_MESSAGE', $old_messages);
 
return $return;
}
 
 
Link to comment
Share on other sites

  • 2 months later...

 

I just updated customer privacy block and now I get this error when I click on Module in back office.

I cannot access Module anymore.

I am on version 1.6.1.1 with default-bootstrap theme. 

Anyone else having same issue and solved, please share.

Thank you in advance.

 

Fatal error: Using $this when not in object context in /home/cnpark70/public_html/modules/blockcustomerprivacy/upgrade/install-2.0.0.php on line 10

[PrestaShop] Fatal error in module file :/home/cnpark70/public_html/modules/blockcustomerprivacy/upgrade/install-2.0.0.php:

Using $this when not in object context

 

And below is the content of install-2.0.0.php file that's making fatal error in line 10

 

<?php

 
if (!defined('_PS_VERSION_'))
exit;
 
function upgrade_module_2_0_0($object)
{
$return = true;
 
$return &= $this->registerHook('displayCustomerIdentityForm');
$return &= $this->unregisterHook('header');
 
$langs = Language::getLanguages(false);
$old_messages = array();
foreach ($langs as $l)
$old_messages[$l['id_lang']] = Configuration::get('CUSTPRIV_MESSAGE', $l['id_lang']);
 
Configuration::updateValue('CUSTPRIV_MESSAGE', $old_messages);
Configuration::updateValue('CUSTPRIV_MESSAGE', $old_messages);
 
return $return;
}

 

Replace this 2 rows:

 

$return &= $this->registerHook('displayCustomerIdentityForm');
$return &= $this->unregisterHook('header');

 

with this:

 

return ($object->registerHook('displayCustomerIdentityForm'));
return ($object->unregisterHook('header'));

 

and the update should continue fine.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...