allow possibility to fix cookie end of life

This commit is contained in:
Manuel Raynaud
2013-08-06 09:50:19 +02:00
parent 17daf2821f
commit dcfb4edda3
3 changed files with 11 additions and 4 deletions

View File

@@ -34,6 +34,7 @@ use Thelia\Core\HttpFoundation\Session\Session;
use Thelia\Form\CartAdd; use Thelia\Form\CartAdd;
use Thelia\Model\CartQuery; use Thelia\Model\CartQuery;
use Thelia\Model\Cart as CartModel; use Thelia\Model\Cart as CartModel;
use Thelia\Model\ConfigQuery;
use Thelia\Model\Customer; use Thelia\Model\Customer;
/** /**
@@ -233,9 +234,12 @@ class Cart implements EventSubscriberInterface
protected function generateCookie() protected function generateCookie()
{ {
$id = uniqid('', true); if (ConfigQuery::read("cart.session_only", 0) == 0) {
setcookie("thelia_cart", $id, time()+(60*60*24*365)); $id = uniqid('', true);
setcookie("thelia_cart", $id, time()+ConfigQuery::read("cookie.lifetime", 60*60*24*365));
return $id;
}
return $id;
} }
} }

View File

@@ -35,6 +35,7 @@ class Cart extends BaseCart
$item->setCart($cart); $item->setCart($cart);
$item->setProductId($cartItem->getProductId()); $item->setProductId($cartItem->getProductId());
$item->setQuantity($cartItem->getQuantity()); $item->setQuantity($cartItem->getQuantity());
$item->setProductSaleElements($productSaleElements);
$item->save(); $item->save();
} }

View File

@@ -392,7 +392,6 @@
<table name="folder" namespace="Thelia\Model"> <table name="folder" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" /> <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="parent" required="true" type="INTEGER" /> <column name="parent" required="true" type="INTEGER" />
<column name="link" size="255" type="VARCHAR" />
<column name="visible" type="TINYINT" /> <column name="visible" type="TINYINT" />
<column name="position" type="INTEGER" /> <column name="position" type="INTEGER" />
<column name="title" size="255" type="VARCHAR" /> <column name="title" size="255" type="VARCHAR" />
@@ -964,6 +963,9 @@
<column name="product_id" required="true" type="INTEGER" /> <column name="product_id" required="true" type="INTEGER" />
<column defaultValue="1" name="quantity" type="FLOAT" /> <column defaultValue="1" name="quantity" type="FLOAT" />
<column name="product_sale_elements_id" required="true" type="INTEGER" /> <column name="product_sale_elements_id" required="true" type="INTEGER" />
<column name="price" type="FLOAT" />
<column name="promo_price" type="FLOAT" />
<column name="price_end of life" type="TIMESTAMP" />
<foreign-key foreignTable="cart" name="fk_cart_item_cart_id"> <foreign-key foreignTable="cart" name="fk_cart_item_cart_id">
<reference foreign="id" local="cart_id" /> <reference foreign="id" local="cart_id" />
</foreign-key> </foreign-key>