Skip to content

Commit 43d1f59

Browse files
ENGCOM-8234: Fix #30073 - Store specific text swatch attribute option label with v… #30114
- Merge Pull Request #30114 from Bartlomiejsz/magento2:bugfix/30073_store_specific_text_swatch_values - Merged commits: 1. 080a349 2. aaab946 3. d552d80 4. 7bdac1b 5. 57ba467 6. 6bc7a61 7. 3b24955 8. 4fccb0c
2 parents a284b63 + 4fccb0c commit 43d1f59

File tree

2 files changed

+167
-125
lines changed

2 files changed

+167
-125
lines changed

app/code/Magento/Swatches/Model/Plugin/EavAttribute.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ protected function processTextualSwatch(Attribute $attribute)
352352
}
353353
$defaultSwatchValue = reset($storeValues);
354354
foreach ($storeValues as $storeId => $value) {
355-
if (!$value) {
355+
if ($value === null || $value === '') {
356356
$value = $defaultSwatchValue;
357357
}
358358
$swatch = $this->loadSwatchIfExists($optionId, $storeId);
@@ -378,8 +378,9 @@ protected function processTextualSwatch(Attribute $attribute)
378378
*/
379379
protected function getAttributeOptionId($optionId)
380380
{
381-
if (substr($optionId, 0, 6) == self::BASE_OPTION_TITLE || substr($optionId, 0, 3) == self::API_OPTION_PREFIX) {
382-
$optionId = isset($this->dependencyArray[$optionId]) ? $this->dependencyArray[$optionId] : null;
381+
if (strpos((string)$optionId, self::BASE_OPTION_TITLE) === 0 ||
382+
strpos((string)$optionId, self::API_OPTION_PREFIX) === 0) {
383+
$optionId = $this->dependencyArray[$optionId] ?? null;
383384
}
384385
return $optionId;
385386
}

0 commit comments

Comments
 (0)