[-] BO : Bugfix : #PSFV-619 : removing the ability to add a new root category if you are not in multishop

// category tree improved
This commit is contained in:
vChabot
2012-03-05 16:52:58 +00:00
parent d25cfdcf7d
commit 4b2a5b2377
3 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -273,7 +273,7 @@ class HelperCore
} }
$root_input = ' '; $root_input = ' ';
if ($root_category->id != $top_category->id || (Tools::isSubmit('ajax') && Tools::getValue('action') == 'getCategoriesFromRootCategory')) if ($root['id_category'] != $top_category->id || (Tools::isSubmit('ajax') && Tools::getValue('action') == 'getCategoriesFromRootCategory'))
$root_input = '<input type="'.(!$use_radio ? 'checkbox' : 'radio').'" name="' $root_input = '<input type="'.(!$use_radio ? 'checkbox' : 'radio').'" name="'
.$input_name.'" value="'.$root['id_category'].'" ' .$input_name.'" value="'.$root['id_category'].'" '
.($home_is_selected ? 'checked' : '').' onclick="clickOnCategoryBox($(this));" /> .($home_is_selected ? 'checked' : '').' onclick="clickOnCategoryBox($(this));" />
@@ -210,10 +210,11 @@ class AdminCategoriesControllerCore extends AdminController
{ {
if (empty($this->display)) if (empty($this->display))
{ {
$this->toolbar_btn['new-url'] = array( if (Shop::isFeatureActive())
'href' => self::$currentIndex.'&amp;add'.$this->table.'root&amp;token='.$this->token, $this->toolbar_btn['new-url'] = array(
'desc' => $this->l('Add new root category') 'href' => self::$currentIndex.'&amp;add'.$this->table.'root&amp;token='.$this->token,
); 'desc' => $this->l('Add new root category')
);
$this->toolbar_btn['new'] = array( $this->toolbar_btn['new'] = array(
'href' => self::$currentIndex.'&amp;add'.$this->table.'&amp;token='.$this->token, 'href' => self::$currentIndex.'&amp;add'.$this->table.'&amp;token='.$this->token,
'desc' => $this->l('Add new') 'desc' => $this->l('Add new')
@@ -2524,7 +2524,7 @@ class AdminProductsControllerCore extends AdminController
$data = $this->createTemplate($this->tpl_form); $data = $this->createTemplate($this->tpl_form);
// Prepare Categories tree for display in Associations tab // Prepare Categories tree for display in Associations tab
$root = Category::getRootCategory(); $root = Category::getRootCategory();
$default_category = Tools::getValue('id_category', $root->id); $default_category = Tools::getValue('id_category', Configuration::get('PS_HOME_CATEGORY'));
if (!$product->id) if (!$product->id)
$selected_cat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->default_form_language); $selected_cat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->default_form_language);
@@ -2562,12 +2562,13 @@ class AdminProductsControllerCore extends AdminController
$product->manufacturer_name = Manufacturer::getNameById($product->id_manufacturer); $product->manufacturer_name = Manufacturer::getNameById($product->id_manufacturer);
$tab_root = array('id_category' => $root->id, 'name' => $root->name);
$helper = new Helper(); $helper = new Helper();
$data->assign(array('default_category' => $default_category, $data->assign(array('default_category' => $default_category,
'selected_cat_ids' => implode(',', array_keys($selected_cat)), 'selected_cat_ids' => implode(',', array_keys($selected_cat)),
'selected_cat' => $selected_cat, 'selected_cat' => $selected_cat,
'id_category_default' => $product->getDefaultCategory(), 'id_category_default' => $product->getDefaultCategory(),
'category_tree' => $helper->renderCategoryTree(null, $selected_cat, 'categoryBox', false, true), 'category_tree' => $helper->renderCategoryTree($tab_root, $selected_cat, 'categoryBox', false, true),
'product' => $product, 'product' => $product,
'link' => $this->context->link 'link' => $this->context->link
)); ));