@@ -368,8 +368,8 @@ protected function saveAndReplaceAdvancedPrices()
368
368
$ this ->_cachedSkuToDelete = null ;
369
369
}
370
370
$ listSku = [];
371
+ $ tierPrices = [];
371
372
while ($ bunch = $ this ->_dataSourceModel ->getNextBunch ()) {
372
- $ tierPrices = [];
373
373
foreach ($ bunch as $ rowNum => $ rowData ) {
374
374
if (!$ this ->validateRow ($ rowData , $ rowNum )) {
375
375
$ this ->addRowError (ValidatorInterface::ERROR_SKU_IS_EMPTY , $ rowNum );
@@ -397,15 +397,8 @@ protected function saveAndReplaceAdvancedPrices()
397
397
];
398
398
}
399
399
}
400
- if (\Magento \ImportExport \Model \Import::BEHAVIOR_REPLACE == $ behavior ) {
401
- if ($ listSku ) {
402
- $ this ->processCountNewPrices ($ tierPrices );
403
- if ($ this ->deleteProductTierPrices (array_unique ($ listSku ), self ::TABLE_TIER_PRICE )) {
404
- $ this ->saveProductPrices ($ tierPrices , self ::TABLE_TIER_PRICE );
405
- $ this ->setUpdatedAt ($ listSku );
406
- }
407
- }
408
- } elseif (\Magento \ImportExport \Model \Import::BEHAVIOR_APPEND == $ behavior ) {
400
+
401
+ if (\Magento \ImportExport \Model \Import::BEHAVIOR_APPEND == $ behavior ) {
409
402
$ this ->processCountExistingPrices ($ tierPrices , self ::TABLE_TIER_PRICE )
410
403
->processCountNewPrices ($ tierPrices );
411
404
$ this ->saveProductPrices ($ tierPrices , self ::TABLE_TIER_PRICE );
@@ -414,6 +407,17 @@ protected function saveAndReplaceAdvancedPrices()
414
407
}
415
408
}
416
409
}
410
+
411
+ if (\Magento \ImportExport \Model \Import::BEHAVIOR_REPLACE == $ behavior ) {
412
+ if ($ listSku ) {
413
+ $ this ->processCountNewPrices ($ tierPrices );
414
+ if ($ this ->deleteProductTierPrices (array_unique ($ listSku ), self ::TABLE_TIER_PRICE )) {
415
+ $ this ->saveProductPrices ($ tierPrices , self ::TABLE_TIER_PRICE );
416
+ $ this ->setUpdatedAt ($ listSku );
417
+ }
418
+ }
419
+ }
420
+
417
421
return $ this ;
418
422
}
419
423
0 commit comments