1818use Magento \Framework \ObjectManager \ResetAfterRequestInterface ;
1919use Magento \ImportExport \Model \Import ;
2020use Magento \Store \Model \Store ;
21+ use Magento \CatalogImportExport \Model \Import \Product \Type \AbstractType as CatalogImportExportAbstractType ;
2122use Magento \Store \Model \StoreManagerInterface ;
2223
2324/**
2627 * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2728 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2829 */
29- class Bundle extends \ Magento \ CatalogImportExport \ Model \ Import \ Product \ Type \AbstractType implements
30+ class Bundle extends CatalogImportExportAbstractType implements
3031 ResetAfterRequestInterface
3132{
3233 /**
@@ -339,6 +340,31 @@ protected function populateSelectionTemplate($selection, $optionId, $parentId, $
339340 return $ populatedSelection ;
340341 }
341342
343+ /**
344+ * Set cache option selection
345+ *
346+ * @param mixed $existingSelection
347+ * @param mixed $optionTitle
348+ * @param string $selectIndex
349+ * @param mixed $key
350+ * @param string $origKey
351+ * @return void
352+ */
353+ private function setCacheOptionSelection (
354+ mixed $ existingSelection ,
355+ mixed $ optionTitle ,
356+ string $ selectIndex ,
357+ mixed $ key ,
358+ string $ origKey
359+ ): void {
360+ if (!isset ($ this ->_cachedOptions [$ existingSelection ['parent_product_id ' ]]
361+ [$ optionTitle ]['selections ' ][$ selectIndex ][$ key ])
362+ ) {
363+ $ this ->_cachedOptions [$ existingSelection ['parent_product_id ' ]]
364+ [$ optionTitle ]['selections ' ][$ selectIndex ][$ key ] = $ existingSelection [$ origKey ];
365+ }
366+ }
367+
342368 /**
343369 * Deprecated method for retrieving mapping between skus and products.
344370 *
@@ -353,7 +379,7 @@ protected function retrieveProducsByCachedSkus()
353379 /**
354380 * Retrieve mapping between skus and products.
355381 *
356- * @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
382+ * @return CatalogImportExportAbstractType
357383 */
358384 protected function retrieveProductsByCachedSkus ()
359385 {
@@ -372,7 +398,7 @@ protected function retrieveProductsByCachedSkus()
372398 /**
373399 * Save product type specific data.
374400 *
375- * @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
401+ * @return CatalogImportExportAbstractType
376402 */
377403 public function saveData ()
378404 {
@@ -476,7 +502,7 @@ protected function transformBundleCustomAttributes($rowData)
476502 /**
477503 * Populates existing options.
478504 *
479- * @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
505+ * @return CatalogImportExportAbstractType
480506 */
481507 protected function populateExistingOptions ()
482508 {
@@ -515,7 +541,9 @@ protected function populateExistingOptions()
515541 *
516542 * @param array $existingOptions
517543 *
518- * @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
544+ * @return CatalogImportExportAbstractType
545+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
546+ * @SuppressWarnings(PHPMD.NPathComplexity)
519547 */
520548 protected function populateExistingSelections ($ existingOptions )
521549 {
@@ -556,7 +584,7 @@ protected function populateExistingSelections($existingOptions)
556584 /**
557585 * Insert options.
558586 *
559- * @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
587+ * @return CatalogImportExportAbstractType
560588 */
561589 protected function insertOptions ()
562590 {
@@ -632,7 +660,7 @@ protected function populateInsertOptionValues(array $optionIds): array
632660 /**
633661 * Insert selections.
634662 *
635- * @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
663+ * @return CatalogImportExportAbstractType
636664 */
637665 protected function insertSelections ()
638666 {
@@ -666,7 +694,7 @@ protected function insertSelections()
666694 /**
667695 * Insert parent/child product relations
668696 *
669- * @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
697+ * @return CatalogImportExportAbstractType
670698 */
671699 private function insertParentChildRelations ()
672700 {
@@ -722,7 +750,7 @@ protected function _initAttributes()
722750 *
723751 * @param array $productIds
724752 *
725- * @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
753+ * @return CatalogImportExportAbstractType
726754 */
727755 protected function deleteOptionsAndSelections ($ productIds )
728756 {
@@ -764,7 +792,7 @@ protected function deleteOptionsAndSelections($productIds)
764792 /**
765793 * Clear cached values between bunches
766794 *
767- * @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
795+ * @return CatalogImportExportAbstractType
768796 */
769797 protected function clear ()
770798 {
0 commit comments