From ddcade285fcdc48f97f9e41c296a798aadd0b50e Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Thu, 5 Dec 2013 18:37:49 +0100 Subject: [PATCH] [-] CORE : Ensure correct parent category for home categories --- classes/Category.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/classes/Category.php b/classes/Category.php index 264cb82d7..6187934c9 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -153,6 +153,10 @@ class CategoryCore extends ObjectModel { if (!isset($this->level_depth)) $this->level_depth = $this->calcLevelDepth(); + + if ($this->is_root_category) + $this->id_parent = (int)Configuration::get('PS_ROOT_CATEGORY'); + $ret = parent::add($autodate, $null_values); if (Tools::isSubmit('checkBoxShopAsso_category')) foreach (Tools::getValue('checkBoxShopAsso_category') as $id_shop => $value) @@ -185,6 +189,10 @@ class CategoryCore extends ObjectModel { if ($this->id_parent == $this->id) throw new PrestaShopException('a category cannot be it\'s own parent'); + + if ($this->is_root_category) + $this->id_parent = (int)Configuration::get('PS_ROOT_CATEGORY'); + // Update group selection $this->updateGroup($this->groupBox); $this->level_depth = $this->calcLevelDepth();