Skip to content

Commit e053303

Browse files
author
Alex Paliarush
committed
MAGETWO-60479: Importing existing products with 'Replace' behavior gives no errors and deletes them
1 parent 53ae7ab commit e053303

File tree

1 file changed

+3
-2
lines changed
  • app/code/Magento/CatalogImportExport/Model/Import

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,8 @@ public function validateRow(array $rowData, $rowNum)
22962296

22972297
$sku = $rowData[self::COL_SKU];
22982298

2299-
if (isset($this->_oldSku[$sku])) {
2299+
$isNewProduct = !isset($this->_oldSku[$sku]) || (Import::BEHAVIOR_REPLACE == $this->getBehavior());
2300+
if (!$isNewProduct) {
23002301
// can we get all necessary data from existent DB product?
23012302
// check for supported type of existing product
23022303
if (isset($this->_productTypeModels[$this->_oldSku[$sku]['type_id']])) {
@@ -2346,7 +2347,7 @@ public function validateRow(array $rowData, $rowNum)
23462347
$rowAttributesValid = $this->_productTypeModels[$newSku['type_id']]->isRowValid(
23472348
$rowData,
23482349
$rowNum,
2349-
!isset($this->_oldSku[$sku])
2350+
$isNewProduct
23502351
);
23512352
if (!$rowAttributesValid && self::SCOPE_DEFAULT == $rowScope) {
23522353
// mark SCOPE_DEFAULT row as invalid for future child rows if product not in DB already

0 commit comments

Comments
 (0)