Skip to content

Commit 47ed3f1

Browse files
committed
MC-39977: Duplicate Tier Price Can be Imported
- Fix duplicate records are not skipped during import
1 parent 623135d commit 47ed3f1

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -673,18 +673,26 @@ private function getProductEntityLinkField()
673673
/**
674674
* @inheritdoc
675675
*/
676-
public function validateData()
676+
protected function _saveValidatedBunches()
677677
{
678-
$isDataValidated = $this->_dataValidated;
679-
$result = parent::validateData();
680-
if (!$isDataValidated
681-
&& $this->_dataValidated
682-
&& \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND === $this->getBehavior()
678+
if (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND === $this->getBehavior()
683679
&& !$this->_catalogData->isPriceGlobal()
684680
) {
681+
$source = $this->_getSource();
682+
$source->rewind();
683+
while ($source->valid()) {
684+
try {
685+
$rowData = $source->current();
686+
} catch (\InvalidArgumentException $exception) {
687+
$source->next();
688+
continue;
689+
}
690+
$this->validateRow($rowData, $source->key());
691+
$source->next();
692+
}
685693
$this->validateRowsForDuplicate(self::TABLE_TIER_PRICE);
686694
}
687-
return $result;
695+
return parent::_saveValidatedBunches();
688696
}
689697

690698
/**

0 commit comments

Comments
 (0)