[-] FO: Cookie are now sharing when your shop is sharing orders from others shop

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16107 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-06-21 09:54:58 +00:00
parent 9099ec040f
commit fb0ce1bcbd
+8 -11
View File
@@ -114,9 +114,15 @@ $cookieLifetime = (time() + (((int)Configuration::get('PS_COOKIE_LIFETIME_BO') >
if (defined('_PS_ADMIN_DIR_'))
$cookie = new Cookie('psAdmin', '', $cookieLifetime);
else
$cookie = new Cookie('ps'.Context::getContext()->shop->id, '', $cookieLifetime);
Context::getContext()->cookie = $cookie;
{
if (Context::getContext()->shop->getGroup()->share_order)
$cookie = new Cookie('ps-sg'.Context::getContext()->shop->getGroup()->id, '', $cookieLifetime);
else
$cookie = new Cookie('ps-s'.Context::getContext()->shop->id, '', $cookieLifetime);
}
Context::getContext()->cookie = $cookie;
/* Create employee if in BO, customer else */
if (defined('_PS_ADMIN_DIR_'))
{
@@ -135,14 +141,6 @@ else
{
$customer = new Customer($cookie->id_customer);
$customer->logged = $cookie->logged;
if (!isset($cookie->id_cart))
{
$shops_share = Shop::getContextListShopID(Shop::SHARE_ORDER);
$id_cart = Db::getInstance()->getValue('SELECT `id_cart` FROM `'._DB_PREFIX_.'cart` WHERE `id_customer` = "'.(int)$customer->id.'" AND `id_shop` IN ("'.implode('","', $shops_share).'") ORDER BY `id_cart` DESC');
if ($id_cart != false)
$cookie->id_cart = $id_cart;
}
}
else
{
@@ -152,7 +150,6 @@ else
if (Group::isFeatureActive())
$customer->id_default_group = Configuration::get('PS_UNIDENTIFIED_GROUP');
}
$customer->id_guest = $cookie->id_guest;
Context::getContext()->customer = $customer;
}