mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -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
|
||||
$categoryId = null;
|
||||
if ($category) {
|
||||
if ($category) { // Slug
|
||||
$categoryId = $this->category_repository->findBy('slug', $category);
|
||||
if (!$categoryId) {
|
||||
$this->messages->error(trans('visiosoft.module.advs::message.category_not_exist'));
|
||||
@ -166,7 +166,7 @@ class AdvsController extends PublicController
|
||||
array()
|
||||
));
|
||||
}
|
||||
} elseif (isset($param['cat']) && !empty($param['cat'])) {
|
||||
} elseif (isset($param['cat']) && !empty($param['cat'])) { // Only Param
|
||||
$categoryId = $this->category_repository->find($param['cat']);
|
||||
if (!$categoryId) {
|
||||
$this->messages->error(trans('visiosoft.module.advs::message.category_not_exist'));
|
||||
@ -183,7 +183,14 @@ class AdvsController extends PublicController
|
||||
// Search by city slug
|
||||
$cityId = null;
|
||||
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]);
|
||||
unset($param['city']);
|
||||
return redirect($this->fullLink(
|
||||
@ -191,7 +198,7 @@ class AdvsController extends PublicController
|
||||
route('adv_list_seo', [$categoryId->slug, $cityId->slug]),
|
||||
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]);
|
||||
if ($city !== $cityId->slug) {
|
||||
unset($param['city']);
|
||||
@ -201,32 +208,30 @@ class AdvsController extends PublicController
|
||||
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(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug]),
|
||||
array()
|
||||
));
|
||||
} 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']);
|
||||
return redirect($this->fullLink(
|
||||
$param,
|
||||
route('adv_list_seo', [$categoryId->slug]),
|
||||
array()
|
||||
));
|
||||
} else {
|
||||
} else { // Only slug
|
||||
$cityId = $this->cityRepository->findBy('slug', $city);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$isActiveCustomFields = $this->adv_model->is_enabled('customfields');
|
||||
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters, null, $categoryId, $cityId);
|
||||
$advs = $this->adv_repository->addAttributes($advs);
|
||||
|
||||
|
||||
if ($isActiveDopings and $param != null) {
|
||||
$featured_advs = app('Visiosoft\DopingsModule\Http\Controller\DopingsController')->listFeatures($advs);
|
||||
}
|
||||
|
||||
@ -33,13 +33,8 @@
|
||||
<div class="text-muted selected-city">
|
||||
<small>{{ selected_cities_name|join(',') }}</small>
|
||||
</div>
|
||||
<input name="city[]" value="
|
||||
{% if citySlug %}
|
||||
{{ citySlug.id }}
|
||||
{% else %}
|
||||
{{ params.param['city']|join(',') }}
|
||||
{% endif %}
|
||||
" type="hidden">
|
||||
<input name="city[]" type="hidden"
|
||||
value="{% if citySlug %}{{ citySlug.id }}{% else %}{{ params.param['city']|join(',') }}{% endif %}">
|
||||
</div>
|
||||
<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"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user