mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-10 07:16:06 -06:00
#1079 [Sahibinden-Theme] Edit ad url
This commit is contained in:
parent
7bfa132604
commit
c4d63a8971
@ -1,20 +1,19 @@
|
|||||||
{% set formHtml %}
|
{% set formHtml %}
|
||||||
<form action="{{ url_route('visiosoft.module.advs::list') }}" method="get">
|
<form action="{{ url_route('visiosoft.module.advs::list') }}" method="get">
|
||||||
{% endset %}
|
{% endset %}
|
||||||
{% if 'cat' in param|keys %}
|
{% set catSlug = null %}
|
||||||
{% if not param['cat'] is empty %}
|
{% set citySlug = null %}
|
||||||
{% set catId = entries('cats', 'category').find(param['cat']) %}
|
{% set pathInfo = app.request.pathinfo|split('/') %}
|
||||||
{% set cityId = null %}
|
{% if pathInfo[1] == 'c' %}
|
||||||
{% if 'city' in param|keys %}
|
{% set catSlug = pathInfo[2] %}
|
||||||
{% set citiesArray = param['city'][0]|split(',') %}
|
{% endif %}
|
||||||
{% if count(citiesArray) is same as(1) %}
|
{% if pathInfo|length is same as(4) %}
|
||||||
{% set cityId = entries('location', 'cities').find(param['city'][0]) %}
|
{% set citySlug = pathInfo[3] %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% if catSlug %}
|
||||||
{% set formHtml %}
|
{% set formHtml %}
|
||||||
<form action="{{ url_route('adv_list_seo', [catId.slug, cityId.slug]) }}" method="get">
|
<form action="{{ url_route('adv_list_seo', [catSlug, citySlug]) }}" method="get">
|
||||||
{% endset %}
|
{% endset %}
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ formHtml }}
|
{{ formHtml }}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -36,7 +35,9 @@
|
|||||||
'districts':districts,
|
'districts':districts,
|
||||||
'neighborhoods':neighborhoods,
|
'neighborhoods':neighborhoods,
|
||||||
'villages':villages,
|
'villages':villages,
|
||||||
'param':param
|
'param':param,
|
||||||
|
'categoryId':categoryId,
|
||||||
|
'cityId':cityId
|
||||||
})|raw }}
|
})|raw }}
|
||||||
|
|
||||||
<!-- Price Filter Start -->
|
<!-- Price Filter Start -->
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
return $this->model->orderBy('created_at', 'DESC')->where('advs_advs.id', $id)->first();
|
return $this->model->orderBy('created_at', 'DESC')->where('advs_advs.id', $id)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function searchAdvs($type, $param = null, $customParameters = null, $limit = null)
|
public function searchAdvs($type, $param = null, $customParameters = null, $limit = null, $category = null, $city = null)
|
||||||
{
|
{
|
||||||
$isActiveDopings = new AdvModel();
|
$isActiveDopings = new AdvModel();
|
||||||
$isActiveDopings = $isActiveDopings->is_enabled('dopings');
|
$isActiveDopings = $isActiveDopings->is_enabled('dopings');
|
||||||
@ -78,20 +78,21 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
if (!empty($param['country'])) {
|
if (!empty($param['country'])) {
|
||||||
$query = $query->where('country_id', $param['country']);
|
$query = $query->where('country_id', $param['country']);
|
||||||
}
|
}
|
||||||
if (isset($param['city']) and !empty($param['city']) and !empty(array_filter($param['city']))) {
|
if ($city) {
|
||||||
|
$query = $query->where('city', $city->id);
|
||||||
|
} elseif (isset($param['city']) and !empty($param['city']) and !empty(array_filter($param['city']))) {
|
||||||
$query = $query->whereIn('city', $param['city']);
|
$query = $query->whereIn('city', $param['city']);
|
||||||
}
|
}
|
||||||
if (!empty($param['cat'])) {
|
if ($category) {
|
||||||
$cat = new CategoryModel();
|
$cat = new CategoryModel();
|
||||||
$cat_d = $cat->find($param['cat']);
|
if ($category) {
|
||||||
if ($cat_d) {
|
if ($category->parent_category_id == null) {
|
||||||
if ($cat_d->parent_category_id == null) {
|
|
||||||
$catLevel = 1;
|
$catLevel = 1;
|
||||||
} else {
|
} else {
|
||||||
$catLevel = $cat->getCatLevel($param['cat']);
|
$catLevel = $cat->getCatLevel($category->id);
|
||||||
}
|
}
|
||||||
$catLevel = "cat" . $catLevel;
|
$catLevel = "cat" . $catLevel;
|
||||||
$query = $query->where($catLevel, $param['cat']);
|
$query = $query->where($catLevel, $category->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($param['user'])) {
|
if (!empty($param['user'])) {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
|||||||
{
|
{
|
||||||
public function findById($id);
|
public function findById($id);
|
||||||
|
|
||||||
public function searchAdvs($type, $param = null, $customParameters = null, $limit = null);
|
public function searchAdvs($type, $param = null, $customParameters = null, $limit = null, $category = null, $city = null);
|
||||||
|
|
||||||
public function softDeleteAdv($id);
|
public function softDeleteAdv($id);
|
||||||
|
|
||||||
|
|||||||
@ -151,29 +151,41 @@ class AdvsController extends PublicController
|
|||||||
$isActiveDopings = $this->adv_model->is_enabled('dopings');
|
$isActiveDopings = $this->adv_model->is_enabled('dopings');
|
||||||
|
|
||||||
// Search by category slug
|
// Search by category slug
|
||||||
|
$categoryId = null;
|
||||||
if ($category) {
|
if ($category) {
|
||||||
$categoryId = $this->category_repository->findBy('slug', $category);
|
$categoryId = $this->category_repository->findBy('slug', $category);
|
||||||
if ($categoryId) {
|
if (!$categoryId) {
|
||||||
$param['cat'] = $categoryId->id;
|
$this->messages->error(trans('visiosoft.module.advs::message.category_not_exist'));
|
||||||
|
return redirect('/');
|
||||||
}
|
}
|
||||||
} elseif (isset($param['cat']) && !empty($param['cat'])) {
|
if (isset($param['cat'])) {
|
||||||
$categoryId = $this->category_repository->find($param['cat']);
|
unset($param['cat']);
|
||||||
if ($categoryId) {
|
|
||||||
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 (isset($param['cat']) && !empty($param['cat'])) {
|
||||||
|
$categoryId = $this->category_repository->find($param['cat']);
|
||||||
|
if (!$categoryId) {
|
||||||
$this->messages->error(trans('visiosoft.module.advs::message.category_not_exist'));
|
$this->messages->error(trans('visiosoft.module.advs::message.category_not_exist'));
|
||||||
return redirect('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
|
unset($param['cat']);
|
||||||
|
return redirect($this->fullLink(
|
||||||
|
$param,
|
||||||
|
route('adv_list_seo', [$categoryId->slug]),
|
||||||
|
array()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search by city slug
|
// Search by city slug
|
||||||
|
$cityId = null;
|
||||||
if ($category) {
|
if ($category) {
|
||||||
if (is_null($city) && isset($param['city'][0]) && !empty($param['city'][0]) && strpos($param['city'][0], ',') === false) {
|
if (is_null($city) && isset($param['city'][0]) && !empty($param['city'][0]) && strpos($param['city'][0], ',') === false) {
|
||||||
$cityId = $this->cityRepository->find($param['city'][0]);
|
$cityId = $this->cityRepository->find($param['city'][0]);
|
||||||
|
unset($param['city']);
|
||||||
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]),
|
||||||
@ -182,6 +194,7 @@ class AdvsController extends PublicController
|
|||||||
} elseif (isset($param['city']) && !empty($param['city'][0]) && strpos($param['city'][0], ',') === false) {
|
} elseif (isset($param['city']) && !empty($param['city'][0]) && strpos($param['city'][0], ',') === false) {
|
||||||
$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']);
|
||||||
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]),
|
||||||
@ -196,6 +209,7 @@ class AdvsController extends PublicController
|
|||||||
));
|
));
|
||||||
} elseif ($city) {
|
} elseif ($city) {
|
||||||
if (isset($param['city'][0]) && empty($param['city'][0])) {
|
if (isset($param['city'][0]) && empty($param['city'][0])) {
|
||||||
|
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]),
|
||||||
@ -203,14 +217,13 @@ class AdvsController extends PublicController
|
|||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
$cityId = $this->cityRepository->findBy('slug', $city);
|
$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, null, $categoryId, $cityId);
|
||||||
$advs = $this->adv_repository->addAttributes($advs);
|
$advs = $this->adv_repository->addAttributes($advs);
|
||||||
|
|
||||||
|
|
||||||
@ -231,25 +244,23 @@ class AdvsController extends PublicController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($param['cat']) and $param['cat'] != "") {
|
if ($categoryId) {
|
||||||
$cat = $param['cat'];
|
$seo_keywords = $this->category_model->getMeta_keywords($categoryId->id);
|
||||||
$seo_keywords = $this->category_model->getMeta_keywords($param['cat']);
|
$seo_description = $this->category_model->getMeta_description($categoryId->id);
|
||||||
$seo_description = $this->category_model->getMeta_description($param['cat']);
|
$seo_title = $this->category_model->getMeta_title($categoryId->id);
|
||||||
$seo_title = $this->category_model->getMeta_title($param['cat']);
|
|
||||||
|
|
||||||
$this->template->set('meta_keywords', implode(',', $seo_keywords));
|
$this->template->set('meta_keywords', implode(',', $seo_keywords));
|
||||||
$this->template->set('meta_description', $seo_description);
|
$this->template->set('meta_description', $seo_description);
|
||||||
$this->template->set('meta_title', $seo_title);
|
$this->template->set('meta_title', $seo_title);
|
||||||
|
|
||||||
$mainCats = $this->category_model->getMains($cat);
|
$mainCats = $this->category_model->getMains($categoryId->id);
|
||||||
$current_cat = $this->category_model->getCat($cat);
|
$current_cat = $this->category_model->getCat($categoryId->id);
|
||||||
$mainCats[] = [
|
$mainCats[] = [
|
||||||
'id' => $current_cat->id,
|
'id' => $current_cat->id,
|
||||||
'val' => $current_cat->name,
|
'val' => $current_cat->name,
|
||||||
];
|
];
|
||||||
$subCats = $this->category_repository->getSubCatById($cat);
|
$subCats = $this->category_repository->getSubCatById($categoryId->id);
|
||||||
} else {
|
} else {
|
||||||
$cat = null;
|
|
||||||
$mainCats = $this->category_repository->mainCats();
|
$mainCats = $this->category_repository->mainCats();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,7 +281,8 @@ class AdvsController extends PublicController
|
|||||||
$viewType = $this->requestHttp->cookie('viewType');
|
$viewType = $this->requestHttp->cookie('viewType');
|
||||||
|
|
||||||
$compact = compact('advs', 'countries', 'mainCats', 'subCats', 'checkboxes', 'request', 'param',
|
$compact = compact('advs', 'countries', 'mainCats', 'subCats', 'checkboxes', 'request', 'param',
|
||||||
'user', 'featured_advs', 'viewType', 'topfields', 'ranges', 'seenList', 'searchedCountry', 'radio');
|
'user', 'featured_advs', 'viewType', 'topfields', 'ranges', 'seenList', 'searchedCountry', 'radio',
|
||||||
|
'categoryId', 'cityId');
|
||||||
|
|
||||||
return $this->viewTypeBasedRedirect($viewType, $compact);
|
return $this->viewTypeBasedRedirect($viewType, $compact);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
{% if app.request.get('cat') %}
|
{% set catSlug = null %}
|
||||||
|
{% set pathInfo = app.request.pathinfo|split('/') %}
|
||||||
|
{% if pathInfo[1] == 'c' %}
|
||||||
|
{% set catSlug = pathInfo[2] %}
|
||||||
|
{% endif %}
|
||||||
|
{% if catSlug %}
|
||||||
{% for category_breadcrumbs in params.mainCats %}
|
{% for category_breadcrumbs in params.mainCats %}
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="{{ url_route('visiosoft.module.advs::list_cat', [category_breadcrumbs['id']]) }}"
|
<a href="{{ url_route('visiosoft.module.advs::list_cat', [category_breadcrumbs['id']]) }}"
|
||||||
|
|||||||
@ -9,30 +9,27 @@
|
|||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
<div id="category" class="collapse show overflow-auto" aria-labelledby="categoryHeading"
|
<div id="category" class="collapse show overflow-auto" aria-labelledby="categoryHeading"
|
||||||
data-parent="#filter"
|
data-parent="#filter" style="max-height: 300px;">
|
||||||
style="max-height: 300px;">
|
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
{% for maincat in params.mainCats %}
|
{% for maincat in params.mainCats %}
|
||||||
{% set name = maincat['val'] %}
|
{% set name = maincat['val'] %}
|
||||||
{% set id = maincat['id'] %}
|
{% set id = maincat['id'] %}
|
||||||
{% set parent_category = true %}
|
{% set parent_category = true %}
|
||||||
{% if app.request.get('cat') is null or app.request.get('cat') == "" %}
|
{% if app.request.get('cat') is null or app.request.get('cat') == "" %}
|
||||||
{% if params.param['cat'] is null or params.param['cat'] == "" %}
|
{% if params.categoryId is null %}
|
||||||
{% set name = maincat.name %}
|
{% set name = maincat.name %}
|
||||||
{% set id = maincat.id %}
|
{% set id = maincat.id %}
|
||||||
{% set parent_category = false %}
|
{% set parent_category = false %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set catId = entries('cats', 'category').find(id) %}
|
{% set catId = entries('cats', 'category').find(id) %}
|
||||||
{% set cityId = null %}
|
{% set citySlug = null %}
|
||||||
{% if 'city' in params.param|keys %}
|
{% set pathInfo = app.request.pathinfo|split('/') %}
|
||||||
{% set citiesArray = params.param['city'][0]|split(',') %}
|
{% if pathInfo|length is same as(4) %}
|
||||||
{% if count(citiesArray) is same as(1) %}
|
{% set citySlug = pathInfo[3] %}
|
||||||
{% set cityId = entries('location', 'cities').find(params.param['city'][0]) %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{% if(viewType != "map") %}
|
<a href="{% if(viewType != "map") %}
|
||||||
{{ appendRequestURL(request_query(),url_route('adv_list_seo', [catId.slug, cityId.slug]),{}) }}
|
{{ appendRequestURL(request_query(),url_route('adv_list_seo', [catId.slug, citySlug]),{}) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ appendRequestURL(request_query(),url_route('advs_map_list'),{'cat':id}) }}
|
{{ appendRequestURL(request_query(),url_route('advs_map_list'),{'cat':id}) }}
|
||||||
{% endif %}" class="list-group-item list-group-item-action text-truncate">
|
{% endif %}" class="list-group-item list-group-item-action text-truncate">
|
||||||
@ -44,7 +41,7 @@
|
|||||||
{% if subcat.parent_category_id == maincat['id'] %}
|
{% if subcat.parent_category_id == maincat['id'] %}
|
||||||
{% set subCatId = entries('cats', 'category').find(subcat.id) %}
|
{% set subCatId = entries('cats', 'category').find(subcat.id) %}
|
||||||
<a href="{% if(viewType != "map") %}
|
<a href="{% if(viewType != "map") %}
|
||||||
{{ appendRequestURL(request_query(),url_route('adv_list_seo', [subCatId.slug, cityId.slug]),{}) }}
|
{{ appendRequestURL(request_query(),url_route('adv_list_seo', [subCatId.slug, citySlug]),{}) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ appendRequestURL(request_query(),url_route('advs_map_list'),{'cat':subcat.id}) }}
|
{{ appendRequestURL(request_query(),url_route('advs_map_list'),{'cat':subcat.id}) }}
|
||||||
{% endif %}" class="list-group-item list-group-item-action text-truncate">
|
{% endif %}" class="list-group-item list-group-item-action text-truncate">
|
||||||
|
|||||||
@ -37,7 +37,7 @@ $('.filter-city-btn').on('click', function () {
|
|||||||
var countries_value = $('input[name="country"]').val();
|
var countries_value = $('input[name="country"]').val();
|
||||||
var selected__city_request = $('input[name="city[]"]').val();
|
var selected__city_request = $('input[name="city[]"]').val();
|
||||||
if (cities == undefined || $(this).attr('data-parent') != countries_value) {
|
if (cities == undefined || $(this).attr('data-parent') != countries_value) {
|
||||||
$(this).attr('data-parent', countries_value)
|
$(this).attr('data-parent', countries_value);
|
||||||
var promiseForCities = new Promise(function (resolve, reject) {
|
var promiseForCities = new Promise(function (resolve, reject) {
|
||||||
locationCrud('id=' + countries_value, '/ajax/getCities', 'POST', beforeSend(), function (callback) {
|
locationCrud('id=' + countries_value, '/ajax/getCities', 'POST', beforeSend(), function (callback) {
|
||||||
cities = callback;
|
cities = callback;
|
||||||
@ -45,11 +45,11 @@ $('.filter-city-btn').on('click', function () {
|
|||||||
$.each(cities, function (index, value) {
|
$.each(cities, function (index, value) {
|
||||||
$('.filter-location-modal .cities').append(item('city', value.id, value.name));
|
$('.filter-location-modal .cities').append(item('city', value.id, value.name));
|
||||||
});
|
});
|
||||||
if (cities == "")
|
if (cities == "") {
|
||||||
$('.filter-location-modal .cities').html(null_msg);
|
$('.filter-location-modal .cities').html(null_msg);
|
||||||
else if (selected__city_request != "") {
|
} else if (selected__city_request != "") {
|
||||||
$.each(selected__city_request.split(','), function (index, value) {
|
$.each(selected__city_request.split(','), function (index, value) {
|
||||||
$(".filter-location-body .cities li[data-id='" + value + "'] input[type='checkbox']").prop('checked', true);
|
$(".filter-location-body .cities li[data-id='" + value.trim() + "'] input[type='checkbox']").prop('checked', true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
@ -18,15 +18,28 @@
|
|||||||
<span class="float-left">{{ trans("visiosoft.module.location::field.city.name") }}</span>
|
<span class="float-left">{{ trans("visiosoft.module.location::field.city.name") }}</span>
|
||||||
<i class="fas fa-sort-down float-right"></i>
|
<i class="fas fa-sort-down float-right"></i>
|
||||||
</button>
|
</button>
|
||||||
{% set selected_cities = params.param['city'] %}
|
{% set citySlug = null %}
|
||||||
{% set selected_cities_name = [] %}
|
{% set pathInfo = app.request.pathinfo|split('/') %}
|
||||||
{% for selected_city in selected_cities[0]|split(',') %}
|
{% if pathInfo|length is same as(4) %}
|
||||||
{% set selected_cities_name = selected_cities_name|merge([getCity(selected_city|trim(',')).name]) %}
|
{% set citySlug = entries('location', 'cities').findBy('slug', pathInfo[3]) %}
|
||||||
{% endfor %}
|
{% set selected_cities_name = [getCity(citySlug.id).name] %}
|
||||||
|
{% else %}
|
||||||
|
{% set selected_cities = params.param['city'] %}
|
||||||
|
{% set selected_cities_name = [] %}
|
||||||
|
{% for selected_city in selected_cities[0]|split(',') %}
|
||||||
|
{% set selected_cities_name = selected_cities_name|merge([getCity(selected_city|trim(',')).name]) %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
<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="{{ params.param['city']|join(',') }}" type="hidden">
|
<input name="city[]" value="
|
||||||
|
{% if citySlug %}
|
||||||
|
{{ 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