From 1e8d84fd0de89621ff24ddc28cd207b1dff313c1 Mon Sep 17 00:00:00 2001 From: vChabot Date: Mon, 23 Jan 2012 14:50:47 +0000 Subject: [PATCH] // categories multishop improvements (BO breadcrumb + category tree root removed) --- classes/Category.php | 9 +++++--- classes/helper/Helper.php | 21 +++++++++++-------- .../admin/AdminCategoriesController.php | 8 ++++--- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/classes/Category.php b/classes/Category.php index af1827dd2..4ff6e6992 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -671,8 +671,10 @@ class CategoryCore extends ObjectModel if (is_null($id_lang)) $id_lang = $context->language->id; if (!$shop) - $shop = $context->shop; - + if (Shop::isFeatureActive() && $context->shop() != Shop::CONTEXT_SHOP) + $shop = new Shop(Configuration::get('PS_SHOP_DEFAULT')); + else + $shop = $context->shop; $is_more_than_one_root_category = count(Category::getCategoriesWithoutParent()) > 1; if ((!Shop::isFeatureActive() && $is_more_than_one_root_category) || Shop::isFeatureActive() && $is_more_than_one_root_category && $context->shop() != Shop::CONTEXT_SHOP) @@ -922,6 +924,7 @@ class CategoryCore extends ObjectModel $categories = null; $id_current = $this->id; + $context->shop = ($context->shop->id) ? $context->shop : new Shop(Configuration::get('PS_DEFAULT_SHOP')); while (true) { $sql = ' @@ -953,7 +956,7 @@ class CategoryCore extends ObjectModel $categories[] = $result[0]; else if (!$categories) $categories = array(); - if (!$result || ($result[0]['id_category'] == $context->shop->id_category && Shop::isFeatureActive())) + if (!$result || ($result[0]['id_category'] == $context->shop->id_category)) return $categories; $id_current = $result[0]['id_parent']; } diff --git a/classes/helper/Helper.php b/classes/helper/Helper.php index b1a54869d..1a42784b7 100755 --- a/classes/helper/Helper.php +++ b/classes/helper/Helper.php @@ -164,11 +164,11 @@ class HelperCore 'search' => $this->l('Find a category') ); + $top_category = Category::getTopCategory(); + $root_category = Category::getRootCategory(); + $disabled_categories[] = $top_category->id; if (!$root) - { - $root_category = Category::getRootCategory(); $root = array('name' => $root_category->name, 'id_category' => $root_category->id); - } if (!$use_radio) $input_name = $input_name.'[]'; @@ -243,15 +243,18 @@ class HelperCore } } + $root_input = ' '; + if ($root_category->id != $top_category->id) + $root_input = ' + ' + .$root['name']. + ''; $html .= '