From c57a1b3518a6800991d3c50ceb3140e96fb9b4d2 Mon Sep 17 00:00:00 2001 From: Diatrex Date: Fri, 24 Jul 2020 16:12:19 +0300 Subject: [PATCH] #1811 SEO links in cats (remove default country & currency from url params) --- .../views/list/partials/price-filter.twig | 6 +++--- .../advs-module/src/Adv/AdvRepository.php | 6 ++++-- .../ads-list/partials/location-fields.twig | 19 +++++++++++++------ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/addons/default/visiosoft/advs-module/resources/views/list/partials/price-filter.twig b/addons/default/visiosoft/advs-module/resources/views/list/partials/price-filter.twig index f411f6b22..ecc9f995c 100644 --- a/addons/default/visiosoft/advs-module/resources/views/list/partials/price-filter.twig +++ b/addons/default/visiosoft/advs-module/resources/views/list/partials/price-filter.twig @@ -29,9 +29,9 @@
diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php index 3eb0e3e06..c1a714f3e 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php @@ -91,8 +91,10 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface }); } } - if (!empty($param['country'])) { - $query = $query->where('country_id', $param['country']); + $country = isset($param['country']) ? + $param['country'] : setting_value('visiosoft.module.location::default_country'); + if ($country) { + $query = $query->where('country_id', $country); } if ($city) { $query = $query->where('city', $city->id); diff --git a/addons/default/visiosoft/location-module/resources/views/ads-list/partials/location-fields.twig b/addons/default/visiosoft/location-module/resources/views/ads-list/partials/location-fields.twig index 7681901a8..683f018e9 100644 --- a/addons/default/visiosoft/location-module/resources/views/ads-list/partials/location-fields.twig +++ b/addons/default/visiosoft/location-module/resources/views/ads-list/partials/location-fields.twig @@ -3,14 +3,21 @@ {{ trans('visiosoft.module.location::field.address.name') }} - {% set country = setting_value('visiosoft.module.location::default_country') %} - {% if app.request.get('country') %} - {% set country = app.request.get('country') %} - {% endif %} + {% set defaultCountry = setting_value('visiosoft.module.location::default_country') %} + {% set selectedCountry = app.request.get('country') %} - {{ getCountry(country).name }} + {% set countryValue = '' %} + {% if selectedCountry %} + {% set countryName = getCountry(selectedCountry).name %} + {% set countryValue = defaultCountry == selectedCountry ? '' : selectedCountry %} + {% elseif defaultCountry %} + {% set countryName = getCountry(defaultCountry).name %} + {% else %} + {% set countryName = trans("visiosoft.module.location::field.country.name") %} + {% endif %} + {{ countryName }} - +