// errors translations + some improvements

This commit is contained in:
vChabot
2012-01-10 17:20:00 +00:00
parent 2560f50da8
commit 9db2d67140
4 changed files with 71 additions and 69 deletions
+12 -1
View File
@@ -341,7 +341,10 @@ class CategoryCore extends ObjectModel
foreach ($categories as $id_category)
{
$category = new Category($id_category);
$return &= $category->delete();
if ($category->isRootCategoryForAShop())
return false;
else
$return &= $category->delete();
}
return $return;
}
@@ -1298,5 +1301,13 @@ class CategoryCore extends ObjectModel
WHERE `id_parent` = 0
');
}
public function isRootCategoryForAShop()
{
return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `id_shop`
FROM `'._DB_PREFIX_.'shop`
WHERE `id_category` = '.(int)$this->id);
}
}