From e8f79764fe3c106e95762b1563a977c3132a9fd9 Mon Sep 17 00:00:00 2001 From: vedatakd Date: Thu, 12 Dec 2019 13:29:38 +0300 Subject: [PATCH] parent category fixed on null --- .../cats-module/src/Category/CategoryModel.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/default/visiosoft/cats-module/src/Category/CategoryModel.php b/addons/default/visiosoft/cats-module/src/Category/CategoryModel.php index b5b8f7b5d..93e25fe39 100644 --- a/addons/default/visiosoft/cats-module/src/Category/CategoryModel.php +++ b/addons/default/visiosoft/cats-module/src/Category/CategoryModel.php @@ -26,14 +26,16 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface if ($subCat != null) { for ($i = 0; $i < 7; $i++) { $parCat = $this->getCat($subCat); - if ($parCat->parent_category_id == "") { - if ($type == "add_main") - $catNames[] = $parCat->name; - break; + if (isset($parCat)) { + if ($parCat->parent_category_id == "") { + if ($type == "add_main") + $catNames[] = $parCat->name; + break; + } + $catNames[] = $parCat->name; + $cat_ids[] = $parCat->id; + $subCat = $parCat->parent_category_id; } - $catNames[] = $parCat->name; - $cat_ids[] = $parCat->id; - $subCat = $parCat->parent_category_id; } } if ($type == 'category_ids') {