@@ -455,6 +455,42 @@ private function getBaseBundleSelectionPriceSelect(): Select
455
455
return $ select ;
456
456
}
457
457
458
+ /**
459
+ * Get base select for bundle selection price update
460
+ *
461
+ * @return Select
462
+ * @throws \Exception
463
+ */
464
+ private function getBaseBundleSelectionPriceUpdateSelect (): Select
465
+ {
466
+ $ metadata = $ this ->metadataPool ->getMetadata (ProductInterface::class);
467
+ $ linkField = $ metadata ->getLinkField ();
468
+ $ bundleSelectionTable = $ this ->getBundleSelectionTable ();
469
+
470
+ $ select = $ this ->getConnection ()->select ()
471
+ ->join (
472
+ ['i ' => $ this ->getBundlePriceTable ()],
473
+ "i.entity_id = $ bundleSelectionTable.entity_id
474
+ AND i.customer_group_id = $ bundleSelectionTable.customer_group_id
475
+ AND i.website_id = $ bundleSelectionTable.website_id " ,
476
+ []
477
+ )->join (
478
+ ['parent_product ' => $ this ->getTable ('catalog_product_entity ' )],
479
+ 'parent_product.entity_id = i.entity_id ' ,
480
+ []
481
+ )->join (
482
+ ['bo ' => $ this ->getTable ('catalog_product_bundle_option ' )],
483
+ "bo.parent_id = parent_product. $ linkField AND bo.option_id = $ bundleSelectionTable.option_id " ,
484
+ ['option_id ' ]
485
+ )->join (
486
+ ['bs ' => $ this ->getTable ('catalog_product_bundle_selection ' )],
487
+ "bs.option_id = bo.option_id AND bs.selection_id = $ bundleSelectionTable.selection_id " ,
488
+ ['selection_id ' ]
489
+ );
490
+
491
+ return $ select ;
492
+ }
493
+
458
494
/**
459
495
* Apply selections price for fixed bundles
460
496
*
@@ -498,7 +534,7 @@ private function applyFixedBundleSelectionPrice()
498
534
]
499
535
);
500
536
501
- $ select = $ this ->getBaseBundleSelectionPriceSelect ();
537
+ $ select = $ this ->getBaseBundleSelectionPriceUpdateSelect ();
502
538
$ select ->joinInner (
503
539
['bsp ' => $ this ->getTable ('catalog_product_bundle_selection_price ' )],
504
540
'bs.selection_id = bsp.selection_id AND bsp.website_id = i.website_id ' ,
0 commit comments