allow possibility to fix cookie end of life
This commit is contained in:
@@ -34,6 +34,7 @@ use Thelia\Core\HttpFoundation\Session\Session;
|
||||
use Thelia\Form\CartAdd;
|
||||
use Thelia\Model\CartQuery;
|
||||
use Thelia\Model\Cart as CartModel;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
/**
|
||||
@@ -233,9 +234,12 @@ class Cart implements EventSubscriberInterface
|
||||
|
||||
protected function generateCookie()
|
||||
{
|
||||
$id = uniqid('', true);
|
||||
setcookie("thelia_cart", $id, time()+(60*60*24*365));
|
||||
if (ConfigQuery::read("cart.session_only", 0) == 0) {
|
||||
$id = uniqid('', true);
|
||||
setcookie("thelia_cart", $id, time()+ConfigQuery::read("cookie.lifetime", 60*60*24*365));
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ class Cart extends BaseCart
|
||||
$item->setCart($cart);
|
||||
$item->setProductId($cartItem->getProductId());
|
||||
$item->setQuantity($cartItem->getQuantity());
|
||||
$item->setProductSaleElements($productSaleElements);
|
||||
$item->save();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user