// merge 6036 6069 6071 6093

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@6094 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-04-28 11:32:07 +00:00
parent 991e2c701d
commit be17931df6
3 changed files with 50 additions and 24 deletions
+7 -3
View File
@@ -32,9 +32,13 @@ function regenerate_level_depth()
foreach($cats as $cat)
{
$category = new Category((int)$cat['id_category']);
$catParent = new Category((int)$category->id_parent);
$category->level_depth = $catParent->level_depth +1;
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'category` SET `level_depth` = '.(int)$category->level_depth.' WHERE `id_category` = '.(int)$category->id);
// if the category has no parent, it's the home
if ((int)$category->id_parent != 0)
{
$catParent = new Category((int)$category->id_parent);
$category->level_depth = $catParent->level_depth +1;
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'category` SET `level_depth` = '.(int)$category->level_depth.' WHERE `id_category` = '.(int)$category->id);
}
}
Category::regenerateEntireNtree();