From aa341425cce0a47288b2d2e9418f50054d685598 Mon Sep 17 00:00:00 2001 From: magentix Date: Thu, 24 Oct 2024 15:42:33 +0200 Subject: [PATCH] PGTO-398: Do not create an empty value for visual and color swatch in stores --- CHANGELOG.md | 3 +++ Job/Option.php | 7 ++++--- composer.json | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b236280c..9a75cf7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -523,3 +523,6 @@ * PGTO-480: Fix request to match existing options * Set default product name to empty instead of null * Update UUID according sku configured column + +### Version 104.3.16 : +* PGTO-398: Do not create an empty value for visual and color swatch in stores diff --git a/Job/Option.php b/Job/Option.php index 824715d5..c3193829 100644 --- a/Job/Option.php +++ b/Job/Option.php @@ -556,12 +556,13 @@ public function insertSwatchOption(): void $dataToInsert = []; foreach ($swatchesAttributesData as $swatchesAttributeData) { - $optionTypeAndValue = $this->getTypeAndValue($swatchesAttributes, $swatchesAttributeData); - if ((int)$optionTypeAndValue['type'] === Swatch::SWATCH_TYPE_VISUAL_IMAGE && + // Do not add value for visual and color swatch if store is not default + if ($swatchesAttributes[$swatchesAttributeData['attribute']] !== Swatch::SWATCH_TYPE_TEXTUAL_ATTRIBUTE_FRONTEND_INPUT && (int)$swatchesAttributeData['store_id'] !== 0) { continue; } + $optionTypeAndValue = $this->getTypeAndValue($swatchesAttributes, $swatchesAttributeData); $dataToInsert[] = [ 'option_id' => $swatchesAttributeData['option_id'], 'store_id' => $swatchesAttributeData['store_id'], @@ -596,7 +597,7 @@ public function getTypeAndValue(array $swatchesAttributes, array $swatchesAttrib ]; } - // Keep the current data for visual swatch + // Keep the current data for visual and color swatch /** @var AdapterInterface $connection */ $connection = $this->entitiesHelper->getConnection(); $current = $connection->fetchRow( diff --git a/composer.json b/composer.json index 8bf69715..42004c84 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "nyholm/psr7": "^1.5" }, "type": "magento2-module", - "version": "104.3.15", + "version": "104.3.16", "license": [ "OSL-3.0", "AFL-3.0"