File tree Expand file tree Collapse file tree 2 files changed +13
-19
lines changed
BundleGraphQl/Model/Resolver/Options
Bundle/Model/ResourceModel/Option Expand file tree Collapse file tree 2 files changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -99,34 +99,20 @@ public function joinValues($storeId)
99
99
*/
100
100
public function setProductIdFilter ($ productId )
101
101
{
102
- $ this ->productIds [] = $ productId ;
103
-
104
102
$ productTable = $ this ->getTable ('catalog_product_entity ' );
105
103
$ linkField = $ this ->getConnection ()->getAutoIncrementField ($ productTable );
106
104
$ this ->getSelect ()->join (
107
105
['cpe ' => $ productTable ],
108
106
'cpe. ' .$ linkField .' = main_table.parent_id ' ,
109
107
[]
110
108
)->where (
111
- "cpe.entity_id = (?) " ,
112
- $ this -> productIds
109
+ "cpe.entity_id = ? " ,
110
+ $ productId
113
111
);
114
112
115
113
return $ this ;
116
114
}
117
115
118
- /**
119
- * Clear product id's after load to insure valid future usage of collection.
120
- *
121
- * @return $this
122
- */
123
- protected function _afterLoad ()
124
- {
125
- $ this ->productIds = [];
126
-
127
- return parent ::_afterLoad ();
128
- }
129
-
130
116
/**
131
117
* Set product link filter
132
118
*
Original file line number Diff line number Diff line change @@ -99,9 +99,17 @@ private function fetch() : array
99
99
$ optionsCollection = $ this ->bundleOptionFactory ->create ()->getResourceCollection ();
100
100
// All products in collection will have same store id.
101
101
$ optionsCollection ->joinValues ($ this ->storeManager ->getStore ()->getId ());
102
- foreach ($ this ->skuMap as $ parentInfo ) {
103
- $ optionsCollection ->setProductIdFilter ($ parentInfo ['entity_id ' ]);
104
- }
102
+
103
+ $ productTable = $ optionsCollection ->getTable ('catalog_product_entity ' );
104
+ $ linkField = $ optionsCollection ->getConnection ()->getAutoIncrementField ($ productTable );
105
+ $ optionsCollection ->getSelect ()->join (
106
+ ['cpe ' => $ productTable ],
107
+ 'cpe. ' .$ linkField .' = main_table.parent_id ' ,
108
+ []
109
+ )->where (
110
+ "cpe.entity_id IN (?) " ,
111
+ $ this ->skuMap
112
+ );
105
113
$ optionsCollection ->setPositionOrder ();
106
114
107
115
$ this ->extensionAttributesJoinProcessor ->process ($ optionsCollection );
You can’t perform that action at this time.
0 commit comments