// Fix default context in shop
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15576 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
f1b7e0b834
commit
233caca6e6
1 file changed
+27
-25
+27
-25
@@ -651,30 +651,36 @@ 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)
|
|
||||||
{
|
{
|
||||||
case self::CONTEXT_ALL :
|
self::$context_id_shop = (int)Context::getContext()->shop->id;
|
||||||
self::$context_id_shop = null;
|
self::$context_id_shop_group = (int)Context::getContext()->shop->id_shop_group;
|
||||||
self::$context_id_shop_group = null;
|
self::$context = self::CONTEXT_ALL;
|
||||||
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;
|
||||||
|
|
||||||
self::$context = $type;
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$context = $type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getContext()
|
public static function getContext()
|
||||||
@@ -700,8 +706,6 @@ class ShopCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function addSqlRestriction($share = false, $alias = null)
|
public static function addSqlRestriction($share = false, $alias = null)
|
||||||
{
|
{
|
||||||
if (!Shop::isFeatureActive())
|
|
||||||
return;
|
|
||||||
if ($alias)
|
if ($alias)
|
||||||
$alias .= '.';
|
$alias .= '.';
|
||||||
|
|
||||||
@@ -747,8 +751,6 @@ class ShopCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function addSqlRestrictionOnLang($alias = null, $id_shop = null)
|
public static function addSqlRestrictionOnLang($alias = null, $id_shop = null)
|
||||||
{
|
{
|
||||||
if (!Shop::isFeatureActive())
|
|
||||||
return;
|
|
||||||
if (is_null($id_shop))
|
if (is_null($id_shop))
|
||||||
$id_shop = Context::getContext()->shop->id;
|
$id_shop = Context::getContext()->shop->id;
|
||||||
return ' AND '.(($alias) ? $alias.'.' : '').'id_shop = '.$id_shop.' ';
|
return ' AND '.(($alias) ? $alias.'.' : '').'id_shop = '.$id_shop.' ';
|
||||||
|
|||||||
Reference in new issue
Block a user