diff --git a/core/lib/Thelia/Action/Cart.php b/core/lib/Thelia/Action/Cart.php index 1883dd733..5fb1847a2 100755 --- a/core/lib/Thelia/Action/Cart.php +++ b/core/lib/Thelia/Action/Cart.php @@ -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; } } diff --git a/core/lib/Thelia/Model/Cart.php b/core/lib/Thelia/Model/Cart.php index 2e2a1206c..9c0441d81 100644 --- a/core/lib/Thelia/Model/Cart.php +++ b/core/lib/Thelia/Model/Cart.php @@ -35,6 +35,7 @@ class Cart extends BaseCart $item->setCart($cart); $item->setProductId($cartItem->getProductId()); $item->setQuantity($cartItem->getQuantity()); + $item->setProductSaleElements($productSaleElements); $item->save(); } diff --git a/local/config/schema.xml b/local/config/schema.xml index 46850f8b2..b6c6e4ed1 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -392,7 +392,6 @@ - @@ -964,6 +963,9 @@ + + +