From 69e2cf95d68a85fe2c5a0aa4a7cc4978a0cd18dc Mon Sep 17 00:00:00 2001 From: rMalie Date: Fri, 24 Feb 2012 08:58:21 +0000 Subject: [PATCH] // Restore shop context in shop list and can filter shop pages per group shop git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13579 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/functions.php | 16 ++++++++++++---- classes/shop/Shop.php | 10 ---------- controllers/admin/AdminShopController.php | 3 +++ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/admin-dev/functions.php b/admin-dev/functions.php index 87f0c27f7..f3faf94ea 100644 --- a/admin-dev/functions.php +++ b/admin-dev/functions.php @@ -418,10 +418,18 @@ function generateShopList() foreach ($tree as $gID => $group_data) { $disabled = ($group_data['totalShops'] != count($group_data['shops'])) ? 'disabled="disabled"' : ''; - $html .= ''; - foreach ($group_data['shops'] as $sID => $shopData) - if ($shopData['active']) - $html .= ''; + if ($context->controller->multishop_context & Shop::CONTEXT_GROUP) + $html .= ''; + else + $html .= ''; + + if ($context->controller->multishop_context & Shop::CONTEXT_SHOP) + foreach ($group_data['shops'] as $sID => $shopData) + if ($shopData['active']) + $html .= ''; + + if (!($context->controller->multishop_context & Shop::CONTEXT_GROUP)) + $html .= ''; } $html .= ''; diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index e9e11f7ca..d23895b5c 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -689,16 +689,6 @@ class ShopCore extends ObjectModel return self::$context_id_group_shop; } - /** - * Get ID shop from context - * - * @return int - */ - public static function getContextGroupID() - { - return Shop::getContext('group'); - } - /** * Add an sql restriction for shops fields * diff --git a/controllers/admin/AdminShopController.php b/controllers/admin/AdminShopController.php index 6bb202e32..401861d3b 100755 --- a/controllers/admin/AdminShopController.php +++ b/controllers/admin/AdminShopController.php @@ -237,6 +237,9 @@ class AdminShopControllerCore extends AdminController public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false) { + if (Shop::getContext() == Shop::CONTEXT_GROUP) + $this->_where .= ' AND a.id_group_shop = '.(int)Shop::getContextGroupShopID(); + parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop); $shop_delete_list = array();