From 9207609f01eff53fa048655fee689a9606e64fe6 Mon Sep 17 00:00:00 2001 From: Diatrex Date: Tue, 1 Dec 2020 18:08:32 +0300 Subject: [PATCH] #2599 ad count for sahibinden-base theme --- .../resources/config/settings/sections.php | 1 + .../resources/config/settings/settings.php | 7 +++++++ .../advs-module/resources/lang/en/setting.php | 4 ++++ .../resources/views/partials/categories-web.twig | 13 +++++++++++++ 4 files changed, 25 insertions(+) diff --git a/addons/default/visiosoft/advs-module/resources/config/settings/sections.php b/addons/default/visiosoft/advs-module/resources/config/settings/sections.php index 75de1d0be..fa065ac54 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/sections.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/sections.php @@ -30,6 +30,7 @@ return [ 'default_published_time', 'default_GET', 'listing_page_image', + 'show_ads_count', ], ], 'create_ad' => [ diff --git a/addons/default/visiosoft/advs-module/resources/config/settings/settings.php b/addons/default/visiosoft/advs-module/resources/config/settings/settings.php index 7ef868ffe..4fe4cb3df 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/settings.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/settings.php @@ -325,4 +325,11 @@ return [ 'mode' => 'checkbox' ], ], + 'show_ads_count' => [ + 'type' => 'anomaly.field_type.boolean', + 'config' => [ + 'default_value' => true, + 'mode' => 'checkbox' + ], + ], ]; diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/setting.php b/addons/default/visiosoft/advs-module/resources/lang/en/setting.php index 56e9cf779..679abec1e 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/setting.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/setting.php @@ -197,4 +197,8 @@ return [ 'show_breadcrumb_when_creating_ad' => [ 'name' => 'Show Breadcrumb When Creating an Ad', ], + 'show_ads_count' => [ + 'name' => 'Show Ads Count', + 'instructions' => 'Show ads count on the left categories list', + ], ]; diff --git a/addons/default/visiosoft/base-theme/resources/views/partials/categories-web.twig b/addons/default/visiosoft/base-theme/resources/views/partials/categories-web.twig index 7335b7d0a..2d2d19d84 100644 --- a/addons/default/visiosoft/base-theme/resources/views/partials/categories-web.twig +++ b/addons/default/visiosoft/base-theme/resources/views/partials/categories-web.twig @@ -5,6 +5,12 @@ {{ main_category.name }} {{ main_category.name }} + {% if setting_value('visiosoft.module.advs::show_ads_count') %} + {% set catAdsCount = entries('advs', 'advs').countAdsByCategoryId(main_category.id) %} + + ({{ catAdsCount }}) + + {% endif %}