[-] BO : Change Nested categories
This commit is contained in:
1 parent
4e8658f1d6
commit
e91460b8fe
1 file changed
+7
-2
@@ -477,8 +477,13 @@ class CategoryCore extends ObjectModel
|
|||||||
return $categories;
|
return $categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getNestedCategories($id_lang = false, $active = true, $sql_filter = '', $sql_sort = '', $sql_limit = '')
|
public static function getNestedCategories($parent_category = 0,
|
||||||
|
$id_lang = false, $active = true, $sql_filter = '', $sql_sort = '',
|
||||||
|
$sql_limit = '')
|
||||||
{
|
{
|
||||||
|
if (!Validate::isInt($parent_category))
|
||||||
|
die(Tools::displayError());
|
||||||
|
|
||||||
if (!Validate::isBool($active))
|
if (!Validate::isBool($active))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
@@ -501,7 +506,7 @@ class CategoryCore extends ObjectModel
|
|||||||
$current = &$buff[$row['id_category']];
|
$current = &$buff[$row['id_category']];
|
||||||
$current = $row;
|
$current = $row;
|
||||||
|
|
||||||
if ($row['id_parent'] == 0)
|
if ($row['id_parent'] == $parent_category)
|
||||||
$categories[$row['id_category']] = &$current;
|
$categories[$row['id_category']] = &$current;
|
||||||
else
|
else
|
||||||
$buff[$row['id_parent']]['children'][$row['id_category']] = &$current;
|
$buff[$row['id_parent']]['children'][$row['id_category']] = &$current;
|
||||||
|
|||||||
Reference in new issue
Block a user