Skip to content

Commit 6ab0dee

Browse files
committed
MAGETWO-73922: Import doesn't allow to set default value per store view (dropdown fields)
1 parent e6fee77 commit 6ab0dee

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ public function __construct(
195195
}
196196

197197
/**
198+
* Initialize template for error message.
199+
*
198200
* @param array $templateCollection
199201
* @return $this
200202
*/
@@ -377,6 +379,8 @@ public function retrieveAttributeFromCache($attributeCode)
377379
}
378380

379381
/**
382+
* Adding attribute option.
383+
*
380384
* In case we've dynamically added new attribute option during import we need to add it to our cache
381385
* in order to keep it up to date.
382386
*
@@ -508,8 +512,10 @@ public function isSuitable()
508512
}
509513

510514
/**
511-
* Prepare attributes values for save: exclude non-existent, static or with empty values attributes;
512-
* set default values if needed
515+
* Adding default attribute to product before save.
516+
*
517+
* Prepare attributes values for save: exclude non-existent, static or with empty values attributes,
518+
* set default values if needed.
513519
*
514520
* @param array $rowData
515521
* @param bool $withDefaultValue
@@ -537,9 +543,9 @@ public function prepareAttributesWithDefaultValueForSave(array $rowData, $withDe
537543
} else {
538544
$resultAttrs[$attrCode] = $rowData[$attrCode];
539545
}
540-
} elseif (array_key_exists($attrCode, $rowData)) {
546+
} elseif (array_key_exists($attrCode, $rowData) && empty($rowData['_store'])) {
541547
$resultAttrs[$attrCode] = $rowData[$attrCode];
542-
} elseif ($withDefaultValue && null !== $attrParams['default_value']) {
548+
} elseif ($withDefaultValue && null !== $attrParams['default_value'] && empty($rowData['_store'])) {
543549
$resultAttrs[$attrCode] = $attrParams['default_value'];
544550
}
545551
}
@@ -605,7 +611,8 @@ protected function getProductEntityLinkField()
605611
}
606612

607613
/**
608-
* Clean cached values
614+
* Clean cached values.
615+
*
609616
* @since 100.2.0
610617
*/
611618
public function __destruct()

0 commit comments

Comments
 (0)