recently I made SEO optimization for client of mine, and I had to change some things on the server, like use PHP 7 and in Presta Shop admin panel to enable caching and SEO links. I don`t use Presta Shop and I am not familiar with it, but some of this changes broke something in the code. When new user tries to registrate it gets that error :
Fatal error: Uncaught Error: Access to undeclared static property: Validate::$data in /home/unikalna/public_html/classes/ObjectModel.php:1032 Stack trace: #0 /home/unikalna/public_html/controllers/front/AuthController.php(406): ObjectModelCore->validateController() #1 /home/unikalna/public_html/controllers/front/AuthController.php(252): AuthControllerCore->processSubmitAccount() #2 /home/unikalna/public_html/classes/controller/Controller.php(171): AuthControllerCore->postProcess() #3 /home/unikalna/public_html/classes/Dispatcher.php(373): ControllerCore->run() #4 /home/unikalna/public_html/index.php(28): DispatcherCore->dispatch() #5 {main} thrown in /home/unikalna/public_html/classes/ObjectModel.php on line 1032
And also if its already registered and tries to buy something.
Version :PrestaShop™ 1.6.0.6
Solved : Presta Shop 1.6 don`t work with PHP 7
/home/unikalna/public_html/classes/ObjectModel.php:1032
OLD CODE
if (!empty($value) || $value === '0' || ($field == 'postcode' && $value == '0')) {
if (isset($data['validate']) && !Validate::$data['validate']($value) && (!empty($value) || $data['required'])) {
$errors[$field] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is invalid.');
} else {
if (isset($data['copy_post']) && !$data['copy_post']) {
continue;
}
if ($field == 'passwd') {
if ($value = Tools::getValue($field)) {
$this->{$field} = Tools::encrypt($value);
}
} else {
$this->{$field} = $value;
}
}
}
Replace with below code block
NEW CODE
if (!empty($value) || $value === '0' || ($field == 'postcode' && $value == '0')) {
if (isset($data['validate']) && !call_user_func('Validate::'.$data['validate'],$value) && (!empty($value) || $data['required'])) {
$errors[$field] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is invalid.');
} else {
if (isset($data['copy_post']) && !$data['copy_post']) {
continue;
}
if ($field == 'passwd') {
if ($value = Tools::getValue($field)) {
$this->{$field} = Tools::encrypt($value);
}
} else {
$this->{$field} = $value;
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With