@@ -392,15 +392,18 @@ private function migrateAttributeGroups($attributeGroupIds)
392
392
$ sourceRecord = $ this ->factory ->create (['document ' => $ sourceDocument , 'data ' => $ recordData ]);
393
393
$ destinationRecord = $ this ->factory ->create (['document ' => $ destinationDocument ]);
394
394
$ recordTransformer ->transform ($ sourceRecord , $ destinationRecord );
395
- $ recordsToSave -> addRecord ( $ destinationRecord );
395
+
396
396
397
397
$ sourceAttributeGroupName = $ recordData ['attribute_group_name ' ];
398
398
$ destAttributeGroupName = $ destinationRecord ->getValue ('attribute_group_name ' );
399
399
if (in_array ($ recordData ['attribute_set_id ' ], $ productAttributeSetIds )
400
400
&& !in_array ($ sourceAttributeGroupName , $ attributeNameMapping )
401
401
&& $ sourceAttributeGroupName != $ destAttributeGroupName ) {
402
402
$ attributeNameMapping [$ sourceAttributeGroupName ] = $ destAttributeGroupName ;
403
+ $ sortOrder = $ destinationRecord ->getValue ('sort_order ' ) + 200 ;
404
+ $ destinationRecord ->setValue ('sort_order ' , $ sortOrder );
403
405
}
406
+ $ recordsToSave ->addRecord ($ destinationRecord );
404
407
}
405
408
$ this ->saveRecords ($ destinationDocument , $ recordsToSave );
406
409
$ this ->mapProductAttributeGroupNamesSourceDest = $ attributeNameMapping ;
@@ -645,6 +648,9 @@ private function createMapAttributeSetIds()
645
648
);
646
649
foreach ($ this ->initialData ->getAttributeSets (ModelData::TYPE_DEST ) as $ attributeSetId => $ record ) {
647
650
$ entityTypeId = $ this ->mapEntityTypeIdsDestOldNew [$ record ['entity_type_id ' ]];
651
+ if (!isset ($ this ->newAttributeSets [$ entityTypeId . '- ' . $ record ['attribute_set_name ' ]])) {
652
+ continue ;
653
+ }
648
654
$ newAttributeSet = $ this ->newAttributeSets [$ entityTypeId . '- ' . $ record ['attribute_set_name ' ]];
649
655
$ this ->mapAttributeSetIdsDestOldNew [$ attributeSetId ] = $ newAttributeSet ['attribute_set_id ' ];
650
656
$ this ->defaultAttributeSetIds [$ newAttributeSet ['entity_type_id ' ]] = $ newAttributeSet ['attribute_set_id ' ];
0 commit comments