[-] BO : Change Nested categories

This commit is contained in:
Jerome Nadaud
2013-09-09 18:58:32 +02:00
parent 4e8658f1d6
commit e91460b8fe
+7 -2
View File
@@ -477,8 +477,13 @@ class CategoryCore extends ObjectModel
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))
die(Tools::displayError());
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
@@ -501,7 +506,7 @@ class CategoryCore extends ObjectModel
$current = &$buff[$row['id_category']];
$current = $row;
if ($row['id_parent'] == 0)
if ($row['id_parent'] == $parent_category)
$categories[$row['id_category']] = &$current;
else
$buff[$row['id_parent']]['children'][$row['id_category']] = &$current;