parent category fixed on null

This commit is contained in:
vedatakd 2019-12-12 13:29:38 +03:00
parent b61c6544ae
commit e8f79764fe

View File

@ -26,6 +26,7 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
if ($subCat != null) { if ($subCat != null) {
for ($i = 0; $i < 7; $i++) { for ($i = 0; $i < 7; $i++) {
$parCat = $this->getCat($subCat); $parCat = $this->getCat($subCat);
if (isset($parCat)) {
if ($parCat->parent_category_id == "") { if ($parCat->parent_category_id == "") {
if ($type == "add_main") if ($type == "add_main")
$catNames[] = $parCat->name; $catNames[] = $parCat->name;
@ -36,6 +37,7 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
$subCat = $parCat->parent_category_id; $subCat = $parCat->parent_category_id;
} }
} }
}
if ($type == 'category_ids') { if ($type == 'category_ids') {
return CategoryModel::query() return CategoryModel::query()
->whereIn('cats_category.id', $cat_ids) ->whereIn('cats_category.id', $cat_ids)