From c3f1cfbe2215e5d8f867ea4e234857e85076fb73 Mon Sep 17 00:00:00 2001 From: mhaagen85 <87481273+mhaagen85@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:14:27 +0100 Subject: [PATCH 1/3] Added default attribute label Added default label for attribute when frontendlabels are empty --- .../Product/LayeredNavigation/Builder/Attribute.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php b/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php index 46efc5271..2af411f51 100644 --- a/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php +++ b/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php @@ -115,7 +115,9 @@ function ($frontendLabel) use ($storeId) { ); if (!empty($frontendLabels)) { $label = reset($frontendLabels)->getLabel(); - } + } else { + $label = $attribute->getDefaultFrontendLabel(); + } } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { $label = $attributeCode; $attribute = null; From 16d3797dfe03e5a17106aabce9fc711ca6bb5c52 Mon Sep 17 00:00:00 2001 From: mhaagen85 <87481273+mhaagen85@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:19:40 +0100 Subject: [PATCH 2/3] Update Attribute.php --- .../Product/LayeredNavigation/Builder/Attribute.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php b/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php index 2af411f51..978f27d41 100644 --- a/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php +++ b/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php @@ -117,7 +117,7 @@ function ($frontendLabel) use ($storeId) { $label = reset($frontendLabels)->getLabel(); } else { $label = $attribute->getDefaultFrontendLabel(); - } + } } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { $label = $attributeCode; $attribute = null; From c7161b81d04146a6f569bb416e23946dd084967e Mon Sep 17 00:00:00 2001 From: mhaagen85 <87481273+mhaagen85@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:34:04 +0100 Subject: [PATCH 3/3] Update Attribute.php --- .../Product/LayeredNavigation/Builder/Attribute.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php b/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php index 978f27d41..325a3b78a 100644 --- a/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php +++ b/src/module-elasticsuite-catalog-graph-ql/DataProvider/Product/LayeredNavigation/Builder/Attribute.php @@ -107,6 +107,7 @@ public function build(AggregationInterface $aggregation, ?int $storeId): array $label = $attributeCode; try { $attribute = $this->attributeRepository->get($attributeCode); + $label = $attribute->getDefaultFrontendLabel(); $frontendLabels = array_filter( $attribute->getFrontendLabels(), function ($frontendLabel) use ($storeId) { @@ -115,8 +116,6 @@ function ($frontendLabel) use ($storeId) { ); if (!empty($frontendLabels)) { $label = reset($frontendLabels)->getLabel(); - } else { - $label = $attribute->getDefaultFrontendLabel(); } } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { $label = $attributeCode;