Skip to content

Commit 970cd1f

Browse files
MAGNIMEX-195: Improve configurable products import performance
1 parent 6fd5e0f commit 970cd1f

File tree

1 file changed

+22
-0
lines changed
  • app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type

1 file changed

+22
-0
lines changed

app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,10 @@ public function saveData()
817817
}
818818

819819
while ($bunch = $this->_entityModel->getNextBunch()) {
820+
if (!$this->configurableInBunch($bunch)) {
821+
continue;
822+
}
823+
820824
$this->_superAttributesData = [
821825
'attributes' => [],
822826
'labels' => [],
@@ -860,6 +864,24 @@ public function saveData()
860864
return $this;
861865
}
862866

867+
/**
868+
* @param $bunch
869+
* @return bool
870+
*/
871+
protected function configurableInBunch($bunch)
872+
{
873+
$newSku = $this->_entityModel->getNewSku();
874+
foreach ($bunch as $rowNum => $rowData) {
875+
$productData = $newSku[$rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_SKU]];
876+
if (($this->_type == $productData['type_id']) &&
877+
($rowData == $this->_entityModel->isRowAllowedToImport($rowData, $rowNum))
878+
) {
879+
return true;
880+
}
881+
}
882+
return false;
883+
}
884+
863885
/**
864886
* Validate row attributes. Pass VALID row data ONLY as argument.
865887
*

0 commit comments

Comments
 (0)