// errors translations + some improvements
This commit is contained in:
+12
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user