Skip to content

Commit b7d01c3

Browse files
committed
Merge branch 'ACP2E-3461' of https://github.com/adobe-commerce-tier-4/magento2ce into PR-VK-2024-11-27-CE
2 parents f2dec07 + 76b5f92 commit b7d01c3

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

app/code/Magento/ConfigurableProduct/Plugin/CatalogWidget/Block/Product/ProductsListPlugin.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2023 Adobe
4+
* All Rights Reserved.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\ConfigurableProduct\Plugin\CatalogWidget\Block\Product;
@@ -78,14 +77,22 @@ public function afterCreateCollection(ProductsList $subject, Collection $result)
7877
$connection = $this->resource->getConnection();
7978
$productIds = $connection->fetchCol(
8079
$connection
81-
->select()
82-
->from(['e' => $this->resource->getTableName('catalog_product_entity')], ['link_table.parent_id'])
83-
->joinInner(
84-
['link_table' => $this->resource->getTableName('catalog_product_super_link')],
85-
'link_table.product_id = e.' . $linkField,
86-
[]
87-
)
88-
->where('link_table.product_id IN (?)', $searchProducts)
80+
->select()
81+
->from(
82+
['e' => $this->resource->getTableName('catalog_product_entity')],
83+
['entity_table.entity_id']
84+
)
85+
->joinInner(
86+
['link_table' => $this->resource->getTableName('catalog_product_super_link')],
87+
'link_table.product_id = e.entity_id',
88+
[]
89+
)
90+
->joinInner(
91+
['entity_table' => $this->resource->getTableName('catalog_product_entity')],
92+
'entity_table.' . $linkField . ' = link_table.parent_id',
93+
[]
94+
)
95+
->where('link_table.product_id IN (?)', $searchProducts)
8996
);
9097

9198
$configurableProductCollection = $this->productCollectionFactory->create();

app/code/Magento/ConfigurableProduct/Test/Unit/Plugin/CatalogWidget/Block/Product/ProductListPluginTest.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2023 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -110,21 +110,17 @@ public function testAfterCreateCollectionSuccess(): void
110110
$select = $this->createMock(Select::class);
111111
$select->expects($this->once())
112112
->method('from')
113-
->with(['e' => 'catalog_product_entity'], ['link_table.parent_id'])
113+
->with(['e' => 'catalog_product_entity'], ['entity_table.entity_id'])
114114
->willReturn($select);
115-
$select->expects($this->once())
115+
$select->expects($this->exactly(2))
116116
->method('joinInner')
117-
->with(
118-
['link_table' => 'catalog_product_super_link'],
119-
'link_table.product_id = e.' . $linkField,
120-
[]
121-
)->willReturn($select);
117+
->willReturn($select);
122118
$select->expects($this->once())->method('where')->with('link_table.product_id IN (?)', [1, 2]);
123119
$connection = $this->createMock(AdapterInterface::class);
124120
$connection->expects($this->once())->method('select')->willReturn($select);
125121
$connection->expects($this->once())->method('fetchCol')->willReturn([2]);
126122
$this->resource->expects($this->once())->method('getConnection')->willReturn($connection);
127-
$this->resource->expects($this->exactly(2))
123+
$this->resource->expects($this->exactly(3))
128124
->method('getTableName')
129125
->willReturnCallback(fn($param) => match ([$param]) {
130126
['catalog_product_entity'] => 'catalog_product_entity',

0 commit comments

Comments
 (0)