diff --git a/modules/purchaseguide/purchaseguide.php b/modules/purchaseguide/purchaseguide.php index 8da5ae21..2d56c622 100644 --- a/modules/purchaseguide/purchaseguide.php +++ b/modules/purchaseguide/purchaseguide.php @@ -284,16 +284,22 @@ class PurchaseGuide extends Module $id_category = $postModel->id_guide_category; } - // Get selected categories - $model = new GuideCategory($id_category); - if ($model->id_parent === 0) { - $id_main_category = $id_category; - $id_child_category = 0; - } else { - $mainCategory = $model->getCategoryLang($model->id_parent, $cookie->id_lang); - $id_main_category = $mainCategory['id_guide_category']; - $id_child_category = $id_category; - } + if($id_category == 0) { + $model = new GuideCategory(); + $id_main_category = $id_child_category = 0; + } + else { + // Get selected categories + $model = new GuideCategory($id_category); + if ($model->id_parent == 0) { + $id_main_category = $id_category; + $id_child_category = 0; + } else { + $mainCategory = $model->getCategoryLang($model->id_parent, $cookie->id_lang); + $id_main_category = $mainCategory['id_guide_category']; + $id_child_category = $id_category; + } + } $tree = $model->getTree($cookie->id_lang, $isEmployee); $smarty->assign(array(