From df6d3739520f04e535189b575b6ce2c1e04dc0f0 Mon Sep 17 00:00:00 2001 From: Tim-M-S Date: Tue, 21 Sep 2021 17:17:54 +0200 Subject: [PATCH 1/6] add setting for category facet search inclusion into wizard --- resources/lang/de/Widget.properties | 1 + resources/lang/de/Wizard.properties | 1 + resources/lang/en/Widget.properties | 1 + resources/lang/en/Wizard.properties | 1 + src/Config/CeresItemConfig.php | 2 +- .../ShopWizard/Steps/Builder/DisplayedInformationStep.php | 7 +++++++ 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/resources/lang/de/Widget.properties b/resources/lang/de/Widget.properties index 3f0a509815..9772a4d634 100644 --- a/resources/lang/de/Widget.properties +++ b/resources/lang/de/Widget.properties @@ -930,6 +930,7 @@ availabilityFilterLabel = "Verfügbarkeitsfilter" priceFilterLabel = "Preisfilter" ; Category filter categoryFilterLabel = "Kategoriefilter" +categoryPlaceholderDescription = "Das Widget ist nicht sichtbar, wenn die Einstellung 'Kategorien als Filteroptionen bei Suchergebnissen anzeigen' im Wizard des Ceres-Plugins nicht aktiv ist." ; Selected Filter selectedFilterWidgetLabel = "Ausgewählte Filter" ; Manufacturer Filter diff --git a/resources/lang/de/Wizard.properties b/resources/lang/de/Wizard.properties index 55cdfea3ab..362b1aa6b9 100644 --- a/resources/lang/de/Wizard.properties +++ b/resources/lang/de/Wizard.properties @@ -244,6 +244,7 @@ categoryDescriptionBoth = Beschreibung 1 und 2 categoryDescriptionBelow = Welche Kategoriebeschreibung möchtest du unter der Artikelliste anzeigen? enableImageCarousel = Bilderkarussell in der Kategorieansicht aktivieren showCarouselDots = Punkte-Navigation unten im Bilderkarussell anzeigen +showCategoryFilter = Kategorien als Filteroptionen bei Suchergebnissen anzeigen showCarouselNav = Navigationspfeile zum Steuern des Bilderkarussells anzeigen itemViewSettings = Einstellungen für die Artikelansicht itemViewSettingsDescription = Bestellmerkmale in der Artikelansicht diff --git a/resources/lang/en/Widget.properties b/resources/lang/en/Widget.properties index cdc08c7bf4..fda40eb6f1 100644 --- a/resources/lang/en/Widget.properties +++ b/resources/lang/en/Widget.properties @@ -928,6 +928,7 @@ availabilityFilterLabel = "Availability filter" priceFilterLabel = "Price filter" ; Category filter categoryFilterLabel = "Category filter" +categoryPlaceholderDescription = "The widget is not visible if the setting 'Show categories as filter options for search results' in the wizard of the Ceres plugin is not active." ; Selected Filter selectedFilterWidgetLabel = "Selected filters" ; Manufacturer Filter diff --git a/resources/lang/en/Wizard.properties b/resources/lang/en/Wizard.properties index 30e33ae775..0c110ebc51 100644 --- a/resources/lang/en/Wizard.properties +++ b/resources/lang/en/Wizard.properties @@ -247,6 +247,7 @@ categoryDescriptionBoth = Description 1 and 2 categoryDescriptionBelow = Which category description do you want to display below item lists? enableImageCarousel = Show image carousel in the category view showCarouselDots = Show dot navigation in the image carousel +showCategoryFilter = Show categories as filter options for search results showCarouselNav = Show navigation arrows in the image carousel itemViewSettings = Settings for the item view itemViewSettingsDescription = Order characteristics in the item view diff --git a/src/Config/CeresItemConfig.php b/src/Config/CeresItemConfig.php index abe8f65f2d..28fff71c2b 100644 --- a/src/Config/CeresItemConfig.php +++ b/src/Config/CeresItemConfig.php @@ -170,6 +170,6 @@ protected function load() $this->showCategoryDescriptionTop = $this->getTextValue( 'item.show_category_description_top', 'description1' ); $this->showCategoryDescriptionBottom = $this->getTextValue( 'item.show_category_description_bottom', 'none' ); $this->requireOrderProperties = $this->getBooleanValue( 'item.require_all_properties', false ); - + $this->showCategoryFilter = $this->getBooleanValue( 'item.show_category_filter', false ); } } diff --git a/src/Wizard/ShopWizard/Steps/Builder/DisplayedInformationStep.php b/src/Wizard/ShopWizard/Steps/Builder/DisplayedInformationStep.php index 5f961a92ad..17110d7215 100644 --- a/src/Wizard/ShopWizard/Steps/Builder/DisplayedInformationStep.php +++ b/src/Wizard/ShopWizard/Steps/Builder/DisplayedInformationStep.php @@ -147,6 +147,13 @@ private function generateCategoryView(): array "name" => "Wizard.showCarouselNav", ] ], + "displayInfo_showCategoryFilter" => [ + "type" => "checkbox", + "defaultValue" => false, + "options" => [ + "name" => "Wizard.showCategoryFilter", + ] + ], ] ]; } From 540b7fa8914d07ac998e03198da61e146e2f5503 Mon Sep 17 00:00:00 2001 From: Tim-M-S Date: Tue, 21 Sep 2021 17:18:49 +0200 Subject: [PATCH 2/6] show widget placeholder if needed setting is not active --- .../Category/Filter/FilterBaseWidget.twig | 25 +++++++++++++------ .../Category/Filter/FilterBaseWidget.php | 11 ++++++-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/resources/views/Widgets/Category/Filter/FilterBaseWidget.twig b/resources/views/Widgets/Category/Filter/FilterBaseWidget.twig index 5e5e34462a..f74be4c100 100644 --- a/resources/views/Widgets/Category/Filter/FilterBaseWidget.twig +++ b/resources/views/Widgets/Category/Filter/FilterBaseWidget.twig @@ -14,13 +14,22 @@
0 %} style="{{ inlineMargin }}"{% endif %}> - - + {% if className == 'category' and hasCategoryFilter == false %} +
+
+

{{ trans("Ceres::Widget.categoryFilterLabel") }}

+

{{ trans("Ceres::Widget.categoryPlaceholderDescription") }}

+
+
+ {% else %} + + + {% endif %}
{{ Twig.endif() }} diff --git a/src/Widgets/Category/Filter/FilterBaseWidget.php b/src/Widgets/Category/Filter/FilterBaseWidget.php index 12218f014c..f4d2b0bd6d 100644 --- a/src/Widgets/Category/Filter/FilterBaseWidget.php +++ b/src/Widgets/Category/Filter/FilterBaseWidget.php @@ -2,6 +2,7 @@ namespace Ceres\Widgets\Category\Filter; +use Ceres\Config\CeresConfig; use Ceres\Widgets\Helper\BaseWidget; use Ceres\Widgets\Helper\Factories\WidgetSettingsFactory; use IO\Services\ItemSearch\Factories\Faker\FacetFaker; @@ -82,7 +83,13 @@ protected function getPreviewData($widgetSettings) /** @var FacetFaker $facetFaker */ $facetFaker = pluginApp(FacetFaker::class); $facetResult = $facetFaker->fill([]); - - return ['facets' => $facetResult]; + + /** @var CeresConfig $ceresConfig */ + $ceresConfig = pluginApp(CeresConfig::class); + + return [ + 'facets' => $facetResult, + 'hasCategoryFilter' => $ceresConfig->item->showCategoryFilter + ]; } } From 12dd879bb6c9ff8b5ff33c933fc955c2a8f20a90 Mon Sep 17 00:00:00 2001 From: Tim-M-S Date: Tue, 21 Sep 2021 18:55:12 +0200 Subject: [PATCH 3/6] fix wizard, fix check for setting and class --- .../views/Widgets/Category/Filter/FilterBaseWidget.twig | 9 ++++++--- src/Widgets/Category/Filter/FilterBaseWidget.php | 5 +---- src/Wizard/ShopWizard/Mapping/DisplayInfoMapping.php | 6 ++++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/resources/views/Widgets/Category/Filter/FilterBaseWidget.twig b/resources/views/Widgets/Category/Filter/FilterBaseWidget.twig index f74be4c100..859b6584d7 100644 --- a/resources/views/Widgets/Category/Filter/FilterBaseWidget.twig +++ b/resources/views/Widgets/Category/Filter/FilterBaseWidget.twig @@ -10,18 +10,21 @@ {% set appearance = widget.settings.appearance.mobile | default("none") %} +{{ Twig.set("hasCategoryFilter", "ceresConfig.item.showCategoryFilter") }} +{{ Twig.set("className", "className") }} + {{ Twig.if("services.facet.facetDataExists(facets, #{allowedFacetTypes | json_encode}) or #{ isPreview | json_encode }") }}
0 %} style="{{ inlineMargin }}"{% endif %}> - {% if className == 'category' and hasCategoryFilter == false %} + {{ Twig.if("className == 'category' and hasCategoryFilter == false") }}

{{ trans("Ceres::Widget.categoryFilterLabel") }}

{{ trans("Ceres::Widget.categoryPlaceholderDescription") }}

- {% else %} + {{ Twig.else() }} - {% endif %} + {{ Twig.endif() }}
{{ Twig.endif() }} diff --git a/src/Widgets/Category/Filter/FilterBaseWidget.php b/src/Widgets/Category/Filter/FilterBaseWidget.php index f4d2b0bd6d..5ec157fb4d 100644 --- a/src/Widgets/Category/Filter/FilterBaseWidget.php +++ b/src/Widgets/Category/Filter/FilterBaseWidget.php @@ -84,12 +84,9 @@ protected function getPreviewData($widgetSettings) $facetFaker = pluginApp(FacetFaker::class); $facetResult = $facetFaker->fill([]); - /** @var CeresConfig $ceresConfig */ - $ceresConfig = pluginApp(CeresConfig::class); - return [ 'facets' => $facetResult, - 'hasCategoryFilter' => $ceresConfig->item->showCategoryFilter + 'className' => $this->className ]; } } diff --git a/src/Wizard/ShopWizard/Mapping/DisplayInfoMapping.php b/src/Wizard/ShopWizard/Mapping/DisplayInfoMapping.php index d7965139ae..e092f35436 100644 --- a/src/Wizard/ShopWizard/Mapping/DisplayInfoMapping.php +++ b/src/Wizard/ShopWizard/Mapping/DisplayInfoMapping.php @@ -27,6 +27,12 @@ class DisplayInfoMapping "global" => false, "optional" => true, ], + "displayInfo_showCategoryFilter"=> [ + "field" => "item.show_category_filter", + "type" => "string", + "global" => false, + "optional" => true, + ], "displayInfo_showDescriptionTop" => [ "field" => "item.show_category_description_top", "type" => "string", From f1c794fd4db5b1a585b6b5f9976baafe1e61c532 Mon Sep 17 00:00:00 2001 From: Tim-M-S Date: Tue, 21 Sep 2021 18:56:36 +0200 Subject: [PATCH 4/6] remove use statement --- src/Widgets/Category/Filter/FilterBaseWidget.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Widgets/Category/Filter/FilterBaseWidget.php b/src/Widgets/Category/Filter/FilterBaseWidget.php index 5ec157fb4d..d5e2c14eda 100644 --- a/src/Widgets/Category/Filter/FilterBaseWidget.php +++ b/src/Widgets/Category/Filter/FilterBaseWidget.php @@ -2,7 +2,6 @@ namespace Ceres\Widgets\Category\Filter; -use Ceres\Config\CeresConfig; use Ceres\Widgets\Helper\BaseWidget; use Ceres\Widgets\Helper\Factories\WidgetSettingsFactory; use IO\Services\ItemSearch\Factories\Faker\FacetFaker; From efafc096e804a527c3b69fa09f664990c03857b2 Mon Sep 17 00:00:00 2001 From: Franz Mutschler <36404400+fmutschler@users.noreply.github.com> Date: Thu, 23 Sep 2021 14:27:09 +0200 Subject: [PATCH 5/6] Update Widget.properties --- resources/lang/de/Widget.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/de/Widget.properties b/resources/lang/de/Widget.properties index 9772a4d634..5ba34d1db3 100644 --- a/resources/lang/de/Widget.properties +++ b/resources/lang/de/Widget.properties @@ -930,7 +930,7 @@ availabilityFilterLabel = "Verfügbarkeitsfilter" priceFilterLabel = "Preisfilter" ; Category filter categoryFilterLabel = "Kategoriefilter" -categoryPlaceholderDescription = "Das Widget ist nicht sichtbar, wenn die Einstellung 'Kategorien als Filteroptionen bei Suchergebnissen anzeigen' im Wizard des Ceres-Plugins nicht aktiv ist." +categoryPlaceholderDescription = "Dieses Widget ist nur sichtbar, wenn die Einstellung 'Kategorien als Filteroptionen bei Suchergebnissen anzeigen' im plentyShop-Assistenten aktiv ist." ; Selected Filter selectedFilterWidgetLabel = "Ausgewählte Filter" ; Manufacturer Filter From 0195a9b6d1d73f3df5c3abef5df54fa96c4bf8aa Mon Sep 17 00:00:00 2001 From: Franz Mutschler <36404400+fmutschler@users.noreply.github.com> Date: Thu, 23 Sep 2021 14:28:10 +0200 Subject: [PATCH 6/6] Update Widget.properties --- resources/lang/en/Widget.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lang/en/Widget.properties b/resources/lang/en/Widget.properties index fda40eb6f1..9a9fd9b670 100644 --- a/resources/lang/en/Widget.properties +++ b/resources/lang/en/Widget.properties @@ -928,7 +928,7 @@ availabilityFilterLabel = "Availability filter" priceFilterLabel = "Price filter" ; Category filter categoryFilterLabel = "Category filter" -categoryPlaceholderDescription = "The widget is not visible if the setting 'Show categories as filter options for search results' in the wizard of the Ceres plugin is not active." +categoryPlaceholderDescription = "This widget is only visible if the setting 'Show categories as filter options for search results' in the plentyShop assistant is active." ; Selected Filter selectedFilterWidgetLabel = "Selected filters" ; Manufacturer Filter @@ -1016,4 +1016,4 @@ maxPreloadTooltip = "Number of images to be preloaded" ; LanguageDetection languageDetectionLabel = "Language detection" languageDetectionWidgetLabel = "Language detection" -languageDetectionRedirect = "Activate automatic redirect" \ No newline at end of file +languageDetectionRedirect = "Activate automatic redirect"