Closed ndsina closed 7 years ago
Preconditions:
could not reproduce. Please share your import csv file. It might help
I cannot share csv file but I'm experiencing the same bug:
"General system exception happened Additional data: Notice: Undefined index: attr_set_code in ...vendor/magento/module-grouped-import-export/Model/Import/Product/Type/Grouped.php on line 105"
Storeview code is correct (and worked well for other - non grouped - products). Products included in each group have been correctly imported in referred storeview.
I think this issue is also related: https://github.com/magento/magento2/issues/5668
Got the same bug in Magento2.4.2-p2. Fixed it as described in the start of this thread with a composer patch:
diff --git a/application/vendor/magento/module-grouped-import-export/Model/Import/Product/Type/Grouped.php b/application/vendor/magento/module-grouped-import-export/Model/Import/Product/Type/Grouped.php
--- a/Model/Import/Product/Type/Grouped.php
+++ b/Model/Import/Product/Type/Grouped.php (date 1645173694713)
@@ -97,14 +97,10 @@
} else {
continue;
}
- $scope = $this->_entityModel->getRowScope($rowData);
- if (Product::SCOPE_DEFAULT == $scope) {
- $productData = $newSku[strtolower($rowData[Product::COL_SKU])];
- } else {
- $colAttrSet = Product::COL_ATTR_SET;
- $rowData[$colAttrSet] = $productData['attr_set_code'];
- $rowData[Product::COL_TYPE] = $productData['type_id'];
- }
+ $productData = $newSku[strtolower($rowData[Product::COL_SKU])];
+ $colAttrSet = Product::COL_ATTR_SET;
+ $rowData[$colAttrSet] = $productData['attr_set_code'];
+ $rowData[Product::COL_TYPE] = $productData['type_id'];
$productId = $productData[$this->getProductEntityLinkField()];
$linksData['product_ids'][$productId] = true;
Issue is able to reproduce on specific area for different website. Group product create and set with for different website, not for main website @magento-engcom-team
M2 2.4.7-p2
\Magento\GroupedImportExport\Model\Import\Product\Type\Grouped::saveData
Here we have an error in line 135 ('attr_set_code' index does not exist). Looking at the app flow, $productData is set at the very beginning to [] and then, if certain conditions are met, this happens:
$rowData[$colAttrSet] = $productData['attr_set_code']; So this cannot work.
Prerequisites:
Simple products have to exist. If trying to import to empty db it actually works, because it hits 'continue' in line 127 Skus must be written like that: 000016198=1 Probably also error reporting level must be set to high (index not existing is actually a warning) Sku like 000016198=1 is being split here:
\Magento\GroupedImportExport\Model\Import\Product\Type\Grouped::normalizeSkusAndQty for a sku=>qty pair. If there is no $associatedSkusAndQtyPairs in line 112 then again script doesn't hit the loop in which it breaks.
Steps to reproduce
Expected result
Actual result
As a variant of fix could be used this code in the vendor/magento/module-grouped-import-export/Model/Import/Product/Type/Grouped.php file: