From f39b0a6b24e185c20e371cfffac8cf45aeb1ba1e Mon Sep 17 00:00:00 2001 From: vChabot Date: Wed, 18 Apr 2012 08:48:42 +0000 Subject: [PATCH] // categories association for product with multishop and context --- .../controllers/products/associations.tpl | 20 ++++++++++++++----- controllers/admin/AdminProductsController.php | 9 +++++++-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/products/associations.tpl b/admin-dev/themes/default/template/controllers/products/associations.tpl index 0aad16f5b..70fb39855 100644 --- a/admin-dev/themes/default/template/controllers/products/associations.tpl +++ b/admin-dev/themes/default/template/controllers/products/associations.tpl @@ -39,7 +39,15 @@ -
{$category_tree}
+
+ {if !$is_shop_context} +
+ {/if} + {$category_tree} + {if !$is_shop_context} +
+ {/if} +
@@ -48,10 +56,12 @@ - - {l s='Create new category'} - {l s='Create new category'} - + {if $is_shop_context} + + {l s='Create new category'} + {l s='Create new category'} + + {/if} diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 5ebf3ae78..287532a05 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2692,13 +2692,18 @@ class AdminProductsControllerCore extends AdminController $tab_root = array('id_category' => $root->id, 'name' => $root->name); $helper = new Helper(); + if (Shop::getContext() != Shop::CONTEXT_SHOP) + $category_tree = $this->l('You must select a shop if you want to put your product into a particular shop.'); + else + $category_tree = $helper->renderCategoryTree($tab_root, $selected_cat, 'categoryBox', false, true); $data->assign(array('default_category' => $default_category, 'selected_cat_ids' => implode(',', array_keys($selected_cat)), 'selected_cat' => $selected_cat, 'id_category_default' => $product->getDefaultCategory(), - 'category_tree' => $helper->renderCategoryTree($tab_root, $selected_cat, 'categoryBox', false, true), + 'category_tree' => $category_tree, 'product' => $product, - 'link' => $this->context->link + 'link' => $this->context->link, + 'is_shop_context' => Shop::getContext() == Shop::CONTEXT_SHOP )); $this->tpl_form_vars['custom_form'] = $data->fetch();