Skip to content

Commit ee56038

Browse files
author
Eric Bohanon
committed
MAGETWO-89246: Fix bundle issues
1 parent 7e7ad98 commit ee56038

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

app/code/Magento/Bundle/Model/ResourceModel/Option/Collection.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,34 +99,20 @@ public function joinValues($storeId)
9999
*/
100100
public function setProductIdFilter($productId)
101101
{
102-
$this->productIds[] = $productId;
103-
104102
$productTable = $this->getTable('catalog_product_entity');
105103
$linkField = $this->getConnection()->getAutoIncrementField($productTable);
106104
$this->getSelect()->join(
107105
['cpe' => $productTable],
108106
'cpe.'.$linkField.' = main_table.parent_id',
109107
[]
110108
)->where(
111-
"cpe.entity_id = (?)",
112-
$this->productIds
109+
"cpe.entity_id = ?",
110+
$productId
113111
);
114112

115113
return $this;
116114
}
117115

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-
130116
/**
131117
* Set product link filter
132118
*

app/code/Magento/BundleGraphQl/Model/Resolver/Options/Collection.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,17 @@ private function fetch() : array
9999
$optionsCollection = $this->bundleOptionFactory->create()->getResourceCollection();
100100
// All products in collection will have same store id.
101101
$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+
);
105113
$optionsCollection->setPositionOrder();
106114

107115
$this->extensionAttributesJoinProcessor->process($optionsCollection);

0 commit comments

Comments
 (0)