https://github.com/PrestaShop/PrestaShop/issues/31489
Respuesta del bug:
How to fix it:
create a FrontController.php file in /override/classes/controller/
rewrite the recovertCart() function to fix it:
`<?php
class FrontController extends FrontControllerCore
{
/**
Recovers cart information.
@return int|false
*/
protected function recoverCart()
{
if (($id_cart = (int) Tools::getValue('recover_cart')) && Tools::getValue('token_cart') == md5(COOKIE_KEY . 'recover_cart_' . $id_cart)) {
$cart = new Cart((int) $id_cart);
if (Validate::isLoadedObject($cart)) {
$customer = new Customer((int) $cart->id_customer);
if (Validate::isLoadedObject($customer)) {
$customer->logged = 1;
$this->context->customer = $customer;
$this->context->cookie->id_customer = (int) $customer->id;
$this->context->cookie->customer_lastname = $customer->lastname;
$this->context->cookie->customer_firstname = $customer->firstname;
$this->context->cookie->logged = 1;
$this->context->cookie->check_cgv = 1;
$this->context->cookie->is_guest = $customer->isGuest();
$this->context->cookie->passwd = $customer->passwd;
$this->context->cookie->email = $customer->email;
// extra patch line
$this->context->cookie->registerSession(new CustomerSession());
// end patch return
$id_cart; } }
} else {
return false;
}
}
}
`
-> Yo he añadido estas líneas directamente en el archivo original (sin override) y parece que funciona bien
// extra patch line
$this->context->cookie->registerSession(new CustomerSession());
// end patch return