#74 Improvements of SEO link structure like Vebze (there was an error)

This commit is contained in:
Diatrex 2020-02-13 16:16:33 +03:00
parent 941613db33
commit d5ea3ab18b
2 changed files with 43 additions and 34 deletions

View File

@ -1,4 +1,8 @@
{% set formHtml %}
<form action="{{ url_route('visiosoft.module.advs::list') }}" method="get">
{% endset %}
{% if 'cat' in param|keys %}
{% if not param['cat'] is empty %}
{% set catId = entries('cats', 'category').find(param['cat']) %}
{% set cityId = null %}
{% if 'city' in param|keys %}
@ -7,10 +11,12 @@
{% set cityId = entries('location', 'cities').find(param['city'][0]) %}
{% endif %}
{% endif %}
{% set formHtml %}
<form action="{{ url_route('adv_list_seo', [catId.slug, cityId.slug]) }}" method="get">
{% else %}
<form action="{{ url_route('visiosoft.module.advs::list') }}" method="get">
{% endset %}
{% endif %}
{% endif %}
{{ formHtml }}
<div class="row">
<input type="hidden" name="cat" value="{{ app.request.get('cat') }}">
<input type="hidden" name="user" value="{{ app.request.get('user') }}">

View File

@ -164,6 +164,7 @@ class AdvsController extends PublicController
}
// Search by city slug
if ($category) {
if (is_null($city) && isset($param['city'][0]) && !empty($param['city'][0]) && strpos($param['city'][0], ',') === false) {
$cityId = $this->cityRepository->find($param['city'][0]);
return redirect($this->fullLink(
@ -199,6 +200,8 @@ class AdvsController extends PublicController
$param['city'] = [$cityId->id];
}
}
}
$isActiveCustomFields = $this->adv_model->is_enabled('customfields');
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters);