diff --git a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php
index 254bbac57..c303eddc5 100644
--- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php
+++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php
@@ -280,15 +280,16 @@ class AdvsController extends PublicController
if ($categoryId) {
+// if ($hierarchy = $categoryId->getMains()) {
+// dd(123);
+// }
+
$mainCats = $this->category_model->getMains($categoryId->id);
$current_cat = $this->category_model->getCat($categoryId->id);
- $mainCats[] = [
- 'id' => $current_cat->id,
- 'val' => $current_cat->name,
- 'slug' => $current_cat->slug,
- ];
+ $mainCats[] = $current_cat;
$subCats = $this->category_repository->getSubCatById($categoryId->id);
$allCats = false;
+// dd($mainCats);
} else {
$mainCats = $this->category_repository->mainCats();
$allCats = true;
diff --git a/addons/default/visiosoft/cats-module/resources/views/ads-list/partials/cat-filter.twig b/addons/default/visiosoft/cats-module/resources/views/ads-list/partials/cat-filter.twig
new file mode 100644
index 000000000..b7f071376
--- /dev/null
+++ b/addons/default/visiosoft/cats-module/resources/views/ads-list/partials/cat-filter.twig
@@ -0,0 +1,61 @@
+
+ {% for maincat in mainCats %}
+ {% set parent_category = noCat ? false : true %}
+
+ -
+
+ {% if maincat.icon %}
+

+ {% else %}
+ {{ img('visiosoft.module.advs::images/listing/sample-cat-icon.svg').data|raw }}
+ {% endif %}
+
+
+ {{ maincat.name }}
+
+{#
#}
+{# {% for subcat in subCats %}#}
+{# {% if subcat.parent_category_id == maincat.id %}#}
+{# {% set subCatId = entries('cats', 'category').find(subcat.id) %}#}
+
+{# - #}
+{# #}
+{# {{ subcat.name }}#}
+{# #}
+{#
#}
+{# - #}
+{# Test#}
+{# #}
+{#
#}
+{#
#}
+{# #}
+{# {% endif %}#}
+{# {% endfor %}#}
+{#
#}
+
+
+
+
+ -
+
+ {% if maincat.icon %}
+

+ {% else %}
+ {{ img('visiosoft.module.advs::images/listing/sample-cat-icon.svg').data|raw }}
+ {% endif %}
+
+
+
+ {% endfor %}
+
diff --git a/addons/default/visiosoft/cats-module/src/Category/CategoryModel.php b/addons/default/visiosoft/cats-module/src/Category/CategoryModel.php
index ccf3769cd..4d4ac2bbf 100644
--- a/addons/default/visiosoft/cats-module/src/Category/CategoryModel.php
+++ b/addons/default/visiosoft/cats-module/src/Category/CategoryModel.php
@@ -171,17 +171,15 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
return $this->find($cat_id)->name;
}
- public function getMains($id)
+ public function getMains($id = null)
{
+ $id = $id ?: $this->id;
+
$categories = array();
$z = 1;
for ($i = 1; $i <= $z; $i++) {
- if ($main = $this->newQuery()->where('id', $id)->first()) {
- $new = array();
- $new['id'] = $main->id;
- $new['val'] = $main->name;
- $new['slug'] = $main->slug;
- $categories[] = $new;
+ if ($main = $this->newQuery()->where('id', $id)->first()->select('id', 'name', 'slug', '')) {
+ $categories[] = $main;
if ($main->parent_category_id != null) {
$id = $main->parent_category_id;
$z++;