Skip to content

Commit 4923f81

Browse files
author
Slabko,Michael(mslabko)
committed
Merge pull request #598 from magento-troll/m2beta3
[Merchant Beta][MX] Bugfixes for beta 3
2 parents 963597a + 92bb4e6 commit 4923f81

File tree

1 file changed

+20
-6
lines changed
  • app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type

1 file changed

+20
-6
lines changed

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

+20-6
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,23 @@ protected function _loadSkuSuperAttributeValues($bunch, $newSku, $oldSku)
344344
/**
345345
* Array of SKU to array of super attribute values for all products.
346346
*
347+
* @param array $bunch
347348
* @return $this
348349
*/
349-
protected function _loadSkuSuperData()
350+
protected function _loadSkuSuperDataForBunch(array $bunch)
350351
{
351-
if (!$this->_skuSuperData) {
352+
$newSku = $this->_entityModel->getNewSku();
353+
$oldSku = $this->_entityModel->getOldSku();
354+
$productIds = [];
355+
foreach ($bunch as $rowData) {
356+
$sku = $rowData[ImportProduct::COL_SKU];
357+
$productData = isset($newSku[$sku]) ? $newSku[$sku] : $oldSku[$sku];
358+
$productIds[] = $productData['entity_id'];
359+
}
360+
361+
$this->_productSuperAttrs = [];
362+
$this->_skuSuperData = [];
363+
if (!empty($productIds)) {
352364
$mainTable = $this->_resource->getTableName('catalog_product_super_attribute');
353365
$optionTable = $this->_resource->getTableName('eav_attribute_option');
354366
$select = $this->_connection->select()->from(
@@ -362,6 +374,9 @@ protected function _loadSkuSuperData()
362374
'o.attribute_id'
363375
),
364376
['option_id']
377+
)->where(
378+
'product_id IN ( ? )',
379+
$productIds
365380
);
366381

367382
foreach ($this->_connection->fetchAll($select) as $row) {
@@ -696,11 +711,10 @@ public function saveData()
696711
$this->_productSuperData = [];
697712
$this->_productData = null;
698713

699-
if ($this->_entityModel->getBehavior() == \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND) {
700-
$this->_loadSkuSuperData();
701-
}
702-
703714
while ($bunch = $this->_entityModel->getNextBunch()) {
715+
if ($this->_entityModel->getBehavior() == \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND) {
716+
$this->_loadSkuSuperDataForBunch($bunch);
717+
}
704718
if (!$this->configurableInBunch($bunch)) {
705719
continue;
706720
}

0 commit comments

Comments
 (0)