// Fix context in multishop

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15585 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie committed 2012-05-21 19:33:02 +00:00
1 parent b63325917c
commit f969e341c0
1 file changed
+22 -28
+22 -28
View File
@@ -660,36 +660,30 @@ class ShopCore extends ObjectModel
{ {
// Always use global context for mono-shop mode // Always use global context for mono-shop mode
if (!Shop::isFeatureActive()) if (!Shop::isFeatureActive())
$type = self::CONTEXT_ALL;
switch ($type)
{ {
self::$context_id_shop = (int)Context::getContext()->shop->id; case self::CONTEXT_ALL :
self::$context_id_shop_group = (int)Context::getContext()->shop->id_shop_group; self::$context_id_shop = null;
self::$context = self::CONTEXT_ALL; self::$context_id_shop_group = null;
break;
case self::CONTEXT_GROUP :
self::$context_id_shop = null;
self::$context_id_shop_group = (int)$id;
break;
case self::CONTEXT_SHOP :
self::$context_id_shop = (int)$id;
self::$context_id_shop_group = Shop::getGroupFromShop($id);
break;
default :
throw new PrestaShopException('Unknown context for shop');
} }
else
{
switch ($type)
{
case self::CONTEXT_ALL :
self::$context_id_shop = null;
self::$context_id_shop_group = null;
break;
case self::CONTEXT_GROUP : self::$context = $type;
self::$context_id_shop = null;
self::$context_id_shop_group = (int)$id;
break;
case self::CONTEXT_SHOP :
self::$context_id_shop = (int)$id;
self::$context_id_shop_group = Shop::getGroupFromShop($id);
break;
default :
throw new PrestaShopException('Unknown context for shop');
}
self::$context = $type;
}
} }
public static function getContext() public static function getContext()
@@ -718,7 +712,7 @@ class ShopCore extends ObjectModel
if ($alias) if ($alias)
$alias .= '.'; $alias .= '.';
if ($share == Shop::SHARE_CUSTOMER) if ($share == Shop::SHARE_CUSTOMER && Shop::getContext() == Shop::CONTEXT_SHOP)
$restriction = ' AND '.$alias.'id_shop_group = '.(int)Shop::getContextShopGroupID(); $restriction = ' AND '.$alias.'id_shop_group = '.(int)Shop::getContextShopGroupID();
else else
$restriction = ' AND '.$alias.'id_shop IN ('.implode(', ', Shop::getContextListShopID($share)).') '; $restriction = ' AND '.$alias.'id_shop IN ('.implode(', ', Shop::getContextListShopID($share)).') ';