mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 23:06:08 -06:00
#74 Improvements of SEO link structure like Vebze (there was an error)
This commit is contained in:
parent
941613db33
commit
d5ea3ab18b
@ -1,16 +1,22 @@
|
|||||||
{% if 'cat' in param|keys %}
|
{% set formHtml %}
|
||||||
{% set catId = entries('cats', 'category').find(param['cat']) %}
|
|
||||||
{% set cityId = null %}
|
|
||||||
{% if 'city' in param|keys %}
|
|
||||||
{% set citiesArray = param['city'][0]|split(',') %}
|
|
||||||
{% if count(citiesArray) is same as(1) %}
|
|
||||||
{% set cityId = entries('location', 'cities').find(param['city'][0]) %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
<form action="{{ url_route('adv_list_seo', [catId.slug, cityId.slug]) }}" method="get">
|
|
||||||
{% else %}
|
|
||||||
<form action="{{ url_route('visiosoft.module.advs::list') }}" method="get">
|
<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 %}
|
||||||
|
{% set citiesArray = param['city'][0]|split(',') %}
|
||||||
|
{% if count(citiesArray) is same as(1) %}
|
||||||
|
{% 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">
|
||||||
|
{% endset %}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{{ formHtml }}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<input type="hidden" name="cat" value="{{ app.request.get('cat') }}">
|
<input type="hidden" name="cat" value="{{ app.request.get('cat') }}">
|
||||||
<input type="hidden" name="user" value="{{ app.request.get('user') }}">
|
<input type="hidden" name="user" value="{{ app.request.get('user') }}">
|
||||||
|
|||||||
@ -164,42 +164,45 @@ class AdvsController extends PublicController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search by city slug
|
// Search by city slug
|
||||||
if (is_null($city) && isset($param['city'][0]) && !empty($param['city'][0]) && strpos($param['city'][0], ',') === false) {
|
if ($category) {
|
||||||
$cityId = $this->cityRepository->find($param['city'][0]);
|
if (is_null($city) && isset($param['city'][0]) && !empty($param['city'][0]) && strpos($param['city'][0], ',') === false) {
|
||||||
return redirect($this->fullLink(
|
$cityId = $this->cityRepository->find($param['city'][0]);
|
||||||
$param,
|
|
||||||
route('adv_list_seo', [$categoryId->slug, $cityId->slug]),
|
|
||||||
array()
|
|
||||||
));
|
|
||||||
} elseif (isset($param['city']) && !empty($param['city'][0]) && strpos($param['city'][0], ',') === false) {
|
|
||||||
$cityId = $this->cityRepository->find($param['city'][0]);
|
|
||||||
$param['city'] = [$cityId->id];
|
|
||||||
if ($city !== $cityId->slug) {
|
|
||||||
return redirect($this->fullLink(
|
return redirect($this->fullLink(
|
||||||
$param,
|
$param,
|
||||||
route('adv_list_seo', [$categoryId->slug, $cityId->slug]),
|
route('adv_list_seo', [$categoryId->slug, $cityId->slug]),
|
||||||
array()
|
array()
|
||||||
));
|
));
|
||||||
}
|
} elseif (isset($param['city']) && !empty($param['city'][0]) && strpos($param['city'][0], ',') === false) {
|
||||||
} elseif ($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(
|
$param['city'] = [$cityId->id];
|
||||||
$param,
|
if ($city !== $cityId->slug) {
|
||||||
route('adv_list_seo', [$categoryId->slug]),
|
return redirect($this->fullLink(
|
||||||
array()
|
$param,
|
||||||
));
|
route('adv_list_seo', [$categoryId->slug, $cityId->slug]),
|
||||||
} elseif ($city) {
|
array()
|
||||||
if (isset($param['city'][0]) && empty($param['city'][0])) {
|
));
|
||||||
|
}
|
||||||
|
} elseif ($city && isset($param['city'][0]) && !empty($param['city'][0]) && strpos($param['city'][0], ',') !== false) {
|
||||||
return redirect($this->fullLink(
|
return redirect($this->fullLink(
|
||||||
$param,
|
$param,
|
||||||
route('adv_list_seo', [$categoryId->slug]),
|
route('adv_list_seo', [$categoryId->slug]),
|
||||||
array()
|
array()
|
||||||
));
|
));
|
||||||
} else {
|
} elseif ($city) {
|
||||||
$cityId = $this->cityRepository->findBy('slug', $city);
|
if (isset($param['city'][0]) && empty($param['city'][0])) {
|
||||||
$param['city'] = [$cityId->id];
|
return redirect($this->fullLink(
|
||||||
|
$param,
|
||||||
|
route('adv_list_seo', [$categoryId->slug]),
|
||||||
|
array()
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
$cityId = $this->cityRepository->findBy('slug', $city);
|
||||||
|
$param['city'] = [$cityId->id];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$isActiveCustomFields = $this->adv_model->is_enabled('customfields');
|
$isActiveCustomFields = $this->adv_model->is_enabled('customfields');
|
||||||
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters);
|
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters);
|
||||||
$advs = $this->adv_repository->addAttributes($advs);
|
$advs = $this->adv_repository->addAttributes($advs);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user