mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #320 from openclassify/dia
#74 Improvements of SEO link structure like Vebze (there was an error)
This commit is contained in:
commit
726723fc8e
@ -1,16 +1,22 @@
|
||||
{% if 'cat' in param|keys %}
|
||||
{% 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 %}
|
||||
{% 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 %}
|
||||
{% 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 %}
|
||||
{{ formHtml }}
|
||||
<div class="row">
|
||||
<input type="hidden" name="cat" value="{{ app.request.get('cat') }}">
|
||||
<input type="hidden" name="user" value="{{ app.request.get('user') }}">
|
||||
|
||||
@ -161,45 +161,54 @@ class AdvsController extends PublicController
|
||||
if ($categoryId) {
|
||||
$param['cat'] = $categoryId->id;
|
||||
}
|
||||
}
|
||||
|
||||
// Search by city slug
|
||||
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(
|
||||
$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(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug, $cityId->slug]),
|
||||
array()
|
||||
));
|
||||
}
|
||||
} elseif ($city && isset($param['city'][0]) && !empty($param['city'][0]) && strpos($param['city'][0], ',') !== false) {
|
||||
} elseif (isset($param['cat']) && !empty($param['cat'])) {
|
||||
$categoryId = $this->category_repository->find($param['cat']);
|
||||
return redirect($this->fullLink(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug]),
|
||||
array()
|
||||
));
|
||||
} elseif ($city) {
|
||||
if (isset($param['city'][0]) && empty($param['city'][0])) {
|
||||
}
|
||||
|
||||
// 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(
|
||||
$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]);
|
||||
if ($city !== $cityId->slug) {
|
||||
return redirect($this->fullLink(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug, $cityId->slug]),
|
||||
array()
|
||||
));
|
||||
}
|
||||
} elseif ($city && isset($param['city'][0]) && !empty($param['city'][0]) && strpos($param['city'][0], ',') !== false) {
|
||||
return redirect($this->fullLink(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug]),
|
||||
array()
|
||||
));
|
||||
} else {
|
||||
$cityId = $this->cityRepository->findBy('slug', $city);
|
||||
$param['city'] = [$cityId->id];
|
||||
} elseif ($city) {
|
||||
if (isset($param['city'][0]) && empty($param['city'][0])) {
|
||||
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');
|
||||
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters);
|
||||
$advs = $this->adv_repository->addAttributes($advs);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user