mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
#1079 [Sahibinden-Theme] Edit ad url
This commit is contained in:
parent
7f1cc9773a
commit
cbf1e12831
@ -152,7 +152,7 @@ class AdvsController extends PublicController
|
|||||||
|
|
||||||
// Search by category slug
|
// Search by category slug
|
||||||
$categoryId = null;
|
$categoryId = null;
|
||||||
if ($category) {
|
if ($category) { // Slug
|
||||||
$categoryId = $this->category_repository->findBy('slug', $category);
|
$categoryId = $this->category_repository->findBy('slug', $category);
|
||||||
if (!$categoryId) {
|
if (!$categoryId) {
|
||||||
$this->messages->error(trans('visiosoft.module.advs::message.category_not_exist'));
|
$this->messages->error(trans('visiosoft.module.advs::message.category_not_exist'));
|
||||||
@ -166,7 +166,7 @@ class AdvsController extends PublicController
|
|||||||
array()
|
array()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
} elseif (isset($param['cat']) && !empty($param['cat'])) {
|
} elseif (isset($param['cat']) && !empty($param['cat'])) { // Only Param
|
||||||
$categoryId = $this->category_repository->find($param['cat']);
|
$categoryId = $this->category_repository->find($param['cat']);
|
||||||
if (!$categoryId) {
|
if (!$categoryId) {
|
||||||
$this->messages->error(trans('visiosoft.module.advs::message.category_not_exist'));
|
$this->messages->error(trans('visiosoft.module.advs::message.category_not_exist'));
|
||||||
@ -183,7 +183,14 @@ class AdvsController extends PublicController
|
|||||||
// Search by city slug
|
// Search by city slug
|
||||||
$cityId = null;
|
$cityId = null;
|
||||||
if ($category) {
|
if ($category) {
|
||||||
if (is_null($city) && isset($param['city'][0]) && !empty($param['city'][0]) && strpos($param['city'][0], ',') === false) {
|
$isOneCity = isset($param['city'][0])
|
||||||
|
&& !empty($param['city'][0])
|
||||||
|
&& strpos($param['city'][0], ',') === false;
|
||||||
|
$isMultipleCity = isset($param['city'][0])
|
||||||
|
&& !empty($param['city'][0])
|
||||||
|
&& strpos($param['city'][0], ',') !== false;
|
||||||
|
|
||||||
|
if (is_null($city) && $isOneCity) { // Param and no slug
|
||||||
$cityId = $this->cityRepository->find($param['city'][0]);
|
$cityId = $this->cityRepository->find($param['city'][0]);
|
||||||
unset($param['city']);
|
unset($param['city']);
|
||||||
return redirect($this->fullLink(
|
return redirect($this->fullLink(
|
||||||
@ -191,7 +198,7 @@ class AdvsController extends PublicController
|
|||||||
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 ($isOneCity) { // Param and slug
|
||||||
$cityId = $this->cityRepository->find($param['city'][0]);
|
$cityId = $this->cityRepository->find($param['city'][0]);
|
||||||
if ($city !== $cityId->slug) {
|
if ($city !== $cityId->slug) {
|
||||||
unset($param['city']);
|
unset($param['city']);
|
||||||
@ -201,32 +208,30 @@ class AdvsController extends PublicController
|
|||||||
array()
|
array()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
} elseif ($city && isset($param['city'][0]) && !empty($param['city'][0]) && strpos($param['city'][0], ',') !== false) {
|
} elseif ($city && $isMultipleCity) { // Slug and multiple param cities
|
||||||
return redirect($this->fullLink(
|
return redirect($this->fullLink(
|
||||||
$param,
|
$param,
|
||||||
route('adv_list_seo', [$categoryId->slug]),
|
route('adv_list_seo', [$categoryId->slug]),
|
||||||
array()
|
array()
|
||||||
));
|
));
|
||||||
} elseif ($city) {
|
} elseif ($city) {
|
||||||
if (isset($param['city'][0]) && empty($param['city'][0])) {
|
if (isset($param['city'][0]) && empty($param['city'][0])) { // Slug and empty param
|
||||||
unset($param['city']);
|
unset($param['city']);
|
||||||
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 {
|
} else { // Only slug
|
||||||
$cityId = $this->cityRepository->findBy('slug', $city);
|
$cityId = $this->cityRepository->findBy('slug', $city);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$isActiveCustomFields = $this->adv_model->is_enabled('customfields');
|
$isActiveCustomFields = $this->adv_model->is_enabled('customfields');
|
||||||
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters, null, $categoryId, $cityId);
|
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters, null, $categoryId, $cityId);
|
||||||
$advs = $this->adv_repository->addAttributes($advs);
|
$advs = $this->adv_repository->addAttributes($advs);
|
||||||
|
|
||||||
|
|
||||||
if ($isActiveDopings and $param != null) {
|
if ($isActiveDopings and $param != null) {
|
||||||
$featured_advs = app('Visiosoft\DopingsModule\Http\Controller\DopingsController')->listFeatures($advs);
|
$featured_advs = app('Visiosoft\DopingsModule\Http\Controller\DopingsController')->listFeatures($advs);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,13 +33,8 @@
|
|||||||
<div class="text-muted selected-city">
|
<div class="text-muted selected-city">
|
||||||
<small>{{ selected_cities_name|join(',') }}</small>
|
<small>{{ selected_cities_name|join(',') }}</small>
|
||||||
</div>
|
</div>
|
||||||
<input name="city[]" value="
|
<input name="city[]" type="hidden"
|
||||||
{% if citySlug %}
|
value="{% if citySlug %}{{ citySlug.id }}{% else %}{{ params.param['city']|join(',') }}{% endif %}">
|
||||||
{{ citySlug.id }}
|
|
||||||
{% else %}
|
|
||||||
{{ params.param['city']|join(',') }}
|
|
||||||
{% endif %}
|
|
||||||
" type="hidden">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 px-0 py-1">
|
<div class="col-12 px-0 py-1">
|
||||||
<button type="button" class="btn btn-default border border-1 w-100 filter-district-btn" data-toggle="modal"
|
<button type="button" class="btn btn-default border border-1 w-100 filter-district-btn" data-toggle="modal"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user