mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
#3472 listing design improvments - Integrate
This commit is contained in:
parent
5ede6467af
commit
ed40e8a8be
@ -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;
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
<ul id="categoryList" class="py-3 px-2">
|
||||
{% for maincat in mainCats %}
|
||||
{% set parent_category = noCat ? false : true %}
|
||||
|
||||
<li>
|
||||
<div class="d-flex">
|
||||
{% if maincat.icon %}
|
||||
<img src="{{ maincat.icon.url }}" alt="{{ maincat.name }}">
|
||||
{% else %}
|
||||
{{ img('visiosoft.module.advs::images/listing/sample-cat-icon.svg').data|raw }}
|
||||
{% endif %}
|
||||
<div class="ml-2">
|
||||
<a href="{{ appendRequestURL(request_query(),url_route('adv_list_seo', [maincat.slug, cityId.slug]),{},['page']) }}">
|
||||
{{ maincat.name }}
|
||||
</a>
|
||||
{# <ul class="sub-cat mt-1">#}
|
||||
{# {% for subcat in subCats %}#}
|
||||
{# {% if subcat.parent_category_id == maincat.id %}#}
|
||||
{# {% set subCatId = entries('cats', 'category').find(subcat.id) %}#}
|
||||
|
||||
{# <li>#}
|
||||
{# <a href="{{ appendRequestURL(request_query(), url_route('adv_list_seo', [subCatId.slug, citySlug]), {}, ['page']) }}">#}
|
||||
{# {{ subcat.name }}#}
|
||||
{# </a>#}
|
||||
{# <ul>#}
|
||||
{# <li>#}
|
||||
{# <a href="#">Test</a>#}
|
||||
{# <ul>#}
|
||||
{# <li><a href="#">Test</a></li>#}
|
||||
{# <li><a href="#">Test</a></li>#}
|
||||
{# <li><a href="#">Test</a></li>#}
|
||||
{# <li><a href="#">Test</a></li>#}
|
||||
{# <li><a href="#">Test</a></li>#}
|
||||
{# <li><a href="#">Test</a></li>#}
|
||||
{# </ul>#}
|
||||
{# </li>#}
|
||||
{# </ul>#}
|
||||
{# </li>#}
|
||||
{# {% endif %}#}
|
||||
{# {% endfor %}#}
|
||||
{# </ul>#}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<div class="d-flex">
|
||||
{% if maincat.icon %}
|
||||
<img src="{{ maincat.icon.url }}" alt="{{ maincat.name }}">
|
||||
{% else %}
|
||||
{{ img('visiosoft.module.advs::images/listing/sample-cat-icon.svg').data|raw }}
|
||||
{% endif %}
|
||||
<div class="ml-2">
|
||||
<a href="{{ appendRequestURL(request_query(),url_route('adv_list_seo', [maincat.slug, cityId.slug]),{},['page']) }}">
|
||||
{{ maincat.name }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
@ -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++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user