// select associated categories on a shop creation
This commit is contained in:
1 parent
6072e7d3be
commit
cb588e0b6b
2 files changed
+14
-4
No files matched your search
@@ -177,8 +177,12 @@ class AdminShopControllerCore extends AdminController
|
|||||||
'id_category' => $root_category->id_category,
|
'id_category' => $root_category->id_category,
|
||||||
'name' => $root_category->name[$this->context->language->id]
|
'name' => $root_category->name[$this->context->language->id]
|
||||||
);
|
);
|
||||||
|
$selected_cat = array($root_category['id_category']);
|
||||||
|
$children = Category::getChildren($root_category['id_category'], $this->context->language->id);
|
||||||
|
foreach ($children as $child)
|
||||||
|
$selected_cat[] = $child['id_category'];
|
||||||
$helper = new Helper();
|
$helper = new Helper();
|
||||||
$this->content = $helper->renderCategoryTree($root_category, array($root_category['id_category']));
|
$this->content = $helper->renderCategoryTree($root_category, $selected_cat);
|
||||||
}
|
}
|
||||||
parent::displayAjax();
|
parent::displayAjax();
|
||||||
}
|
}
|
||||||
@@ -503,8 +507,14 @@ class AdminShopControllerCore extends AdminController
|
|||||||
$shop = new Shop($id_shop);
|
$shop = new Shop($id_shop);
|
||||||
$selected_cat = Shop::getCategories($id_shop);
|
$selected_cat = Shop::getCategories($id_shop);
|
||||||
if (empty($selected_cat))
|
if (empty($selected_cat))
|
||||||
$selected_cat = array(Category::getRootCategory()->id);
|
{
|
||||||
|
// get first category root and preselect all these children
|
||||||
|
$root_category = Category::getRootCategories();
|
||||||
|
$children = Category::getChildren($root_category[0]['id_category'], $this->context->language->id);
|
||||||
|
$selected_cat[] = $root_category[0]['id_category'];
|
||||||
|
foreach ($children as $child)
|
||||||
|
$selected_cat[] = $child['id_category'];
|
||||||
|
}
|
||||||
if ($this->context->shop() == Shop::CONTEXT_SHOP && Tools::isSubmit('id_shop'))
|
if ($this->context->shop() == Shop::CONTEXT_SHOP && Tools::isSubmit('id_shop'))
|
||||||
$root_category = new Category($shop->id_category);
|
$root_category = new Category($shop->id_category);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ function buildTreeView()
|
|||||||
needUncheckAll = true;
|
needUncheckAll = true;
|
||||||
uncheckAllCategories();
|
uncheckAllCategories();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function callbackToggle(element)
|
function callbackToggle(element)
|
||||||
|
|||||||
Reference in new issue
Block a user