diff --git a/admin-dev/themes/default/template/helper/form/form_category.tpl b/admin-dev/themes/default/template/helper/form/form_category.tpl
index 7615e70d2..931bebea7 100644
--- a/admin-dev/themes/default/template/helper/form/form_category.tpl
+++ b/admin-dev/themes/default/template/helper/form/form_category.tpl
@@ -76,12 +76,16 @@
-
-
- {$categories.trads.Root.name}
+ {if $categories.top_category->id != $categories.trads.Root.id_category}
+
+ {$categories.trads.Root.name}
+ {else}
+
+ {/if}
-
diff --git a/classes/Category.php b/classes/Category.php
index 5e84cd5bb..457399394 100644
--- a/classes/Category.php
+++ b/classes/Category.php
@@ -673,6 +673,8 @@ class CategoryCore extends ObjectModel
$shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
else
$shop = $context->shop;
+ else
+ return new Category($shop->getCategory(), $id_lang);
$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,7 +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'));
+ $context->shop = ($context->shop->id) ? $context->shop : new Shop(Configuration::get('PS_SHOP_DEFAULT'));
while (true)
{
$sql = '
diff --git a/classes/helper/Helper.php b/classes/helper/Helper.php
index 1a42784b7..39fafca58 100755
--- a/classes/helper/Helper.php
+++ b/classes/helper/Helper.php
@@ -165,7 +165,9 @@ class HelperCore
);
$top_category = Category::getTopCategory();
- $root_category = Category::getRootCategory();
+ $id_shop = Tools::isSubmit('id_shop') ? Tools::getValue('id_shop'): Configuration::get('PS_SHOP_DEFAULT');
+ $shop = new Shop($id_shop);
+ $root_category = Category::getRootCategory(null, $shop);
$disabled_categories[] = $top_category->id;
if (!$root)
$root = array('name' => $root_category->name, 'id_category' => $root_category->id);
diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php
index dba16e5b2..64ec9c414 100644
--- a/controllers/admin/AdminCategoriesController.php
+++ b/controllers/admin/AdminCategoriesController.php
@@ -323,6 +323,7 @@ class AdminCategoriesControllerCore extends AdminController
'use_radio' => true,
'use_search' => false,
'disabled_categories' => array(4),
+ 'top_category' => Category::getTopCategory(),
)
),
array(
@@ -407,6 +408,15 @@ class AdminCategoriesControllerCore extends AdminController
'class' => 'button'
)
);
+ if (Shop::isFeatureActive())
+ {
+ $this->fields_form['input'][] = array(
+ 'type' => 'shop',
+ 'label' => $this->l('Shop association:'),
+ 'name' => 'checkBoxShopAsso',
+ 'values' => Shop::getTree()
+ );
+ }
if (Tools::isSubmit('add'.$this->table.'root'))
unset($this->fields_form['input'][2],$this->fields_form['input'][3]);
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php
index 5f6d4081c..56e5a3b95 100644
--- a/controllers/admin/AdminProductsController.php
+++ b/controllers/admin/AdminProductsController.php
@@ -2466,7 +2466,8 @@ class AdminProductsControllerCore extends AdminController
$product = $obj;
$data = $this->createTemplate($this->tpl_form);
// Prepare Categories tree for display in Associations tab
- $default_category = Tools::getValue('id_category', 1);
+ $root = Category::getRootCategory();
+ $default_category = Tools::getValue('id_category', $root->id);
if (!$product->id)
$selected_cat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->default_form_language);