mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-11 07:46:07 -06:00
Merge pull request #311 from openclassify/dia
#74 Improvements of SEO link structure like Vebze
This commit is contained in:
commit
7f2bb843f8
@ -1,4 +1,16 @@
|
|||||||
|
{% 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 %}
|
||||||
<form action="{{ url_route('visiosoft.module.advs::list') }}" method="get">
|
<form action="{{ url_route('visiosoft.module.advs::list') }}" method="get">
|
||||||
|
{% endif %}
|
||||||
<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') }}">
|
||||||
@ -16,7 +28,8 @@
|
|||||||
'cities':cities,
|
'cities':cities,
|
||||||
'districts':districts,
|
'districts':districts,
|
||||||
'neighborhoods':neighborhoods,
|
'neighborhoods':neighborhoods,
|
||||||
'villages':villages
|
'villages':villages,
|
||||||
|
'param':param
|
||||||
})|raw }}
|
})|raw }}
|
||||||
|
|
||||||
<!-- Date Filter Start -->
|
<!-- Date Filter Start -->
|
||||||
|
|||||||
@ -28,10 +28,22 @@ class appendRequestURL
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
if (count($this->new_parameters) === 0 && count($this->request) === 0) {
|
||||||
|
return $this->url;
|
||||||
|
} elseif (count($this->request) > 0) {
|
||||||
|
return $this->url
|
||||||
|
. (Str::contains($this->url, '?') ? '&' : '?')
|
||||||
|
. Arr::query($this->appends($this->request));
|
||||||
|
} elseif (count($this->new_parameters) > 0) {
|
||||||
|
return $this->url
|
||||||
|
. (Str::contains($this->url, '?') ? '&' : '?')
|
||||||
|
. Arr::query($this->appends($this->new_parameters));
|
||||||
|
} else {
|
||||||
return $this->url
|
return $this->url
|
||||||
. (Str::contains($this->url, '?') ? '&' : '?')
|
. (Str::contains($this->url, '?') ? '&' : '?')
|
||||||
. Arr::query($this->appends(array_merge($this->request, $this->new_parameters)));
|
. Arr::query($this->appends(array_merge($this->request, $this->new_parameters)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $key
|
* @param $key
|
||||||
|
|||||||
@ -132,6 +132,10 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
|||||||
],
|
],
|
||||||
'advs/categories' => 'Visiosoft\AdvsModule\Http\Controller\CategoriesController@index',
|
'advs/categories' => 'Visiosoft\AdvsModule\Http\Controller\CategoriesController@index',
|
||||||
'advs/c/{cat}' => 'Visiosoft\AdvsModule\Http\Controller\CategoriesController@listByCat',
|
'advs/c/{cat}' => 'Visiosoft\AdvsModule\Http\Controller\CategoriesController@listByCat',
|
||||||
|
'c/{category?}/{city?}' => [
|
||||||
|
'as' => 'adv_list_seo',
|
||||||
|
'uses' => 'Visiosoft\AdvsModule\Http\Controller\advsController@index'
|
||||||
|
],
|
||||||
'advs/module_active' => 'Visiosoft\AdvsModule\Http\Controller\advsController@index',
|
'advs/module_active' => 'Visiosoft\AdvsModule\Http\Controller\advsController@index',
|
||||||
'advs/create_adv' => [
|
'advs/create_adv' => [
|
||||||
'as' => "advs::create_adv",
|
'as' => "advs::create_adv",
|
||||||
|
|||||||
@ -6,7 +6,8 @@ use Illuminate\Support\Facades\DB;
|
|||||||
|
|
||||||
class CategoriesController extends PublicController {
|
class CategoriesController extends PublicController {
|
||||||
|
|
||||||
public function listByCat($cat) {
|
public function listByCat($cat)
|
||||||
|
{
|
||||||
$advs = DB::table('advs_advs')
|
$advs = DB::table('advs_advs')
|
||||||
->where('cat1', $cat)
|
->where('cat1', $cat)
|
||||||
->orwhere('cat2', $cat)
|
->orwhere('cat2', $cat)
|
||||||
|
|||||||
@ -6,11 +6,13 @@ use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
|
|||||||
use Anomaly\Streams\Platform\Model\Advs\PurchasePurchaseEntryModel;
|
use Anomaly\Streams\Platform\Model\Advs\PurchasePurchaseEntryModel;
|
||||||
use Anomaly\Streams\Platform\Model\Complaints\ComplaintsComplainTypesEntryModel;
|
use Anomaly\Streams\Platform\Model\Complaints\ComplaintsComplainTypesEntryModel;
|
||||||
use Anomaly\Streams\Platform\Model\Options\OptionsAdvertisementEntryModel;
|
use Anomaly\Streams\Platform\Model\Options\OptionsAdvertisementEntryModel;
|
||||||
|
use Visiosoft\AdvsModule\Adv\Command\appendRequestURL;
|
||||||
use Visiosoft\AdvsModule\Adv\Event\showAdPhone;
|
use Visiosoft\AdvsModule\Adv\Event\showAdPhone;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Cookie;
|
use Illuminate\Support\Facades\Cookie;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Visiosoft\LocationModule\City\CityRepository;
|
||||||
use function PMA\Util\get;
|
use function PMA\Util\get;
|
||||||
use Sunra\PhpSimple\HtmlDomParser;
|
use Sunra\PhpSimple\HtmlDomParser;
|
||||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||||
@ -61,6 +63,7 @@ class AdvsController extends PublicController
|
|||||||
private $country_repository;
|
private $country_repository;
|
||||||
|
|
||||||
private $city_model;
|
private $city_model;
|
||||||
|
private $cityRepository;
|
||||||
|
|
||||||
private $district_model;
|
private $district_model;
|
||||||
|
|
||||||
@ -85,6 +88,7 @@ class AdvsController extends PublicController
|
|||||||
CountryRepositoryInterface $country_repository,
|
CountryRepositoryInterface $country_repository,
|
||||||
|
|
||||||
CityModel $city_model,
|
CityModel $city_model,
|
||||||
|
CityRepository $cityRepository,
|
||||||
|
|
||||||
DistrictModel $district_model,
|
DistrictModel $district_model,
|
||||||
|
|
||||||
@ -111,6 +115,7 @@ class AdvsController extends PublicController
|
|||||||
$this->country_repository = $country_repository;
|
$this->country_repository = $country_repository;
|
||||||
|
|
||||||
$this->city_model = $city_model;
|
$this->city_model = $city_model;
|
||||||
|
$this->cityRepository = $cityRepository;
|
||||||
|
|
||||||
$this->district_model = $district_model;
|
$this->district_model = $district_model;
|
||||||
|
|
||||||
@ -138,7 +143,7 @@ class AdvsController extends PublicController
|
|||||||
/**
|
/**
|
||||||
* @return \Illuminate\Contracts\View\View|mixed
|
* @return \Illuminate\Contracts\View\View|mixed
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index($category = null, $city = null)
|
||||||
{
|
{
|
||||||
$customParameters = array();
|
$customParameters = array();
|
||||||
$featured_advs = array();
|
$featured_advs = array();
|
||||||
@ -146,11 +151,55 @@ class AdvsController extends PublicController
|
|||||||
|
|
||||||
$param = $this->requestHttp->toArray();
|
$param = $this->requestHttp->toArray();
|
||||||
|
|
||||||
|
|
||||||
$countries = $this->country_repository->viewAll();
|
$countries = $this->country_repository->viewAll();
|
||||||
|
|
||||||
$isActiveDopings = $this->adv_model->is_enabled('dopings');
|
$isActiveDopings = $this->adv_model->is_enabled('dopings');
|
||||||
|
|
||||||
|
// Search by category slug
|
||||||
|
if ($category) {
|
||||||
|
$categoryId = $this->category_repository->findBy('slug', $category);
|
||||||
|
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) {
|
||||||
|
return redirect($this->fullLink(
|
||||||
|
$param,
|
||||||
|
route('adv_list_seo', [$categoryId->slug]),
|
||||||
|
array()
|
||||||
|
));
|
||||||
|
} 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');
|
$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);
|
||||||
@ -218,7 +267,7 @@ class AdvsController extends PublicController
|
|||||||
|
|
||||||
$viewType = $this->requestHttp->cookie('viewType');
|
$viewType = $this->requestHttp->cookie('viewType');
|
||||||
|
|
||||||
$compact = compact('advs', 'countries', 'mainCats', 'subCats', 'checkboxes', 'request',
|
$compact = compact('advs', 'countries', 'mainCats', 'subCats', 'checkboxes', 'request', 'param',
|
||||||
'user', 'userProfile', 'featured_advs', 'viewType', 'topfields', 'ranges', 'seenList', 'searchedCountry', 'radio');
|
'user', 'userProfile', 'featured_advs', 'viewType', 'topfields', 'ranges', 'seenList', 'searchedCountry', 'radio');
|
||||||
|
|
||||||
if (isset($viewType) and $viewType == 'table')
|
if (isset($viewType) and $viewType == 'table')
|
||||||
@ -231,6 +280,10 @@ class AdvsController extends PublicController
|
|||||||
return $this->view->make('visiosoft.module.advs::list/list', $compact);
|
return $this->view->make('visiosoft.module.advs::list/list', $compact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function fullLink($request, $url, $newParameters) {
|
||||||
|
return $this->dispatch(new appendRequestURL($request, $url, $newParameters));
|
||||||
|
}
|
||||||
|
|
||||||
public function viewType($type)
|
public function viewType($type)
|
||||||
{
|
{
|
||||||
Cookie::queue(Cookie::make('viewType', $type, 84000));
|
Cookie::queue(Cookie::make('viewType', $type, 84000));
|
||||||
|
|||||||
@ -17,33 +17,39 @@
|
|||||||
{% 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'] == "" %}
|
||||||
{% 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 %}
|
||||||
<a href="
|
{% endif %}
|
||||||
{% if(viewType != "map") %}
|
{% set catId = entries('cats', 'category').find(id) %}
|
||||||
{{ appendRequestURL(request_query(),url_route('visiosoft.module.advs::list'),{'cat':id}) }}
|
{% set cityId = null %}
|
||||||
|
{% if 'city' in params.param|keys %}
|
||||||
|
{% set citiesArray = params.param['city'][0]|split(',') %}
|
||||||
|
{% if count(citiesArray) is same as(1) %}
|
||||||
|
{% set cityId = entries('location', 'cities').find(params.param['city'][0]) %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
<a href="{% if(viewType != "map") %}
|
||||||
|
{{ appendRequestURL(request_query(),url_route('adv_list_seo', [catId.slug, cityId.slug]),{}) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ appendRequestURL(request_query(),url_route('advs_map_list'),{'cat':id}) }}
|
{{ appendRequestURL(request_query(),url_route('advs_map_list'),{'cat':id}) }}
|
||||||
{% endif %}
|
{% endif %}" class="list-group-item list-group-item-action text-truncate">
|
||||||
"
|
|
||||||
class="list-group-item list-group-item-action text-truncate">
|
|
||||||
<i class="fas fa-dot-circle"></i>
|
<i class="fas fa-dot-circle"></i>
|
||||||
{{ name }}
|
{{ name }}
|
||||||
</a>
|
</a>
|
||||||
{% for subcat in params.subCats %}
|
{% for subcat in params.subCats %}
|
||||||
<div class="list-group pl-3 bg-light">
|
<div class="list-group pl-3 bg-light">
|
||||||
{% if subcat.parent_category_id == maincat['id'] %}
|
{% if subcat.parent_category_id == maincat['id'] %}
|
||||||
<a href="
|
{% set subCatId = entries('cats', 'category').find(subcat.id) %}
|
||||||
{% if(viewType != "map") %}
|
<a href="{% if(viewType != "map") %}
|
||||||
{{ appendRequestURL(request_query(),url_route('visiosoft.module.advs::list'),{'cat':subcat.id}) }}
|
{{ appendRequestURL(request_query(),url_route('adv_list_seo', [subCatId.slug, cityId.slug]),{}) }}
|
||||||
{% 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 %}
|
{% endif %}" class="list-group-item list-group-item-action text-truncate">
|
||||||
"
|
{{ subcat.name }}
|
||||||
class="list-group-item list-group-item-action
|
</a>
|
||||||
text-truncate">{{ subcat.name }}</a>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
<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 = app.request.get('city') %}
|
{% set selected_cities = params.param['city'] %}
|
||||||
{% set selected_cities_name = [] %}
|
{% set selected_cities_name = [] %}
|
||||||
{% for selected_city in selected_cities[0]|split(',') %}
|
{% for selected_city in selected_cities[0]|split(',') %}
|
||||||
{% set selected_cities_name = selected_cities_name|merge([getCity(selected_city|trim(',')).name]) %}
|
{% set selected_cities_name = selected_cities_name|merge([getCity(selected_city|trim(',')).name]) %}
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<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="{{ app.request.get('city')|join(',') }}" type="hidden">
|
<input name="city[]" value="{{ params.param['city']|join(',') }}" 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