@@ -368,8 +368,8 @@ protected function saveAndReplaceAdvancedPrices()
368368 $ this ->_cachedSkuToDelete = null ;
369369 }
370370 $ listSku = [];
371+ $ tierPrices = [];
371372 while ($ bunch = $ this ->_dataSourceModel ->getNextBunch ()) {
372- $ tierPrices = [];
373373 foreach ($ bunch as $ rowNum => $ rowData ) {
374374 if (!$ this ->validateRow ($ rowData , $ rowNum )) {
375375 $ this ->addRowError (ValidatorInterface::ERROR_SKU_IS_EMPTY , $ rowNum );
@@ -397,15 +397,8 @@ protected function saveAndReplaceAdvancedPrices()
397397 ];
398398 }
399399 }
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 ) {
409402 $ this ->processCountExistingPrices ($ tierPrices , self ::TABLE_TIER_PRICE )
410403 ->processCountNewPrices ($ tierPrices );
411404 $ this ->saveProductPrices ($ tierPrices , self ::TABLE_TIER_PRICE );
@@ -414,6 +407,17 @@ protected function saveAndReplaceAdvancedPrices()
414407 }
415408 }
416409 }
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+
417421 return $ this ;
418422 }
419423
0 commit comments