Skip to content

Commit e493b69

Browse files
committed
Merge branch '2.3.3-develop' of github.com:magento/magento2ce into MC-18721
2 parents 0a0d463 + ec125a7 commit e493b69

File tree

3 files changed

+45
-13
lines changed

3 files changed

+45
-13
lines changed

app/code/Magento/Catalog/Model/ProductLink/Search.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
use Magento\Catalog\Api\Data\ProductInterface;
1212

13-
/** Returns collection of product visible in catalog by search key */
13+
/**
14+
* Returns collection of product visible in catalog by search key
15+
*/
1416
class Search
1517
{
1618
/**
@@ -58,7 +60,6 @@ public function prepareCollection(
5860
): \Magento\Catalog\Model\ResourceModel\Product\Collection {
5961
$productCollection = $this->productCollectionFactory->create();
6062
$productCollection->addAttributeToSelect(ProductInterface::NAME);
61-
$productCollection->setVisibility($this->catalogVisibility->getVisibleInCatalogIds());
6263
$productCollection->setPage($pageNum, $limit);
6364
$this->filter->addFilter($productCollection, 'fulltext', ['fulltext' => $searchKey]);
6465
$productCollection->setPage($pageNum, $limit);

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AttributeSet.php

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,20 @@ public function getOptions()
7878
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection::SORT_ORDER_ASC
7979
);
8080

81-
return $collection->getData();
81+
$collectionData = $collection->getData() ?? [];
82+
83+
array_walk(
84+
$collectionData,
85+
function (&$attribute) {
86+
$attribute['__disableTmpl'] = true;
87+
}
88+
);
89+
90+
return $collectionData;
8291
}
8392

8493
/**
85-
* {@inheritdoc}
94+
* @inheritdoc
8695
* @since 101.0.0
8796
*/
8897
public function modifyMeta(array $meta)
@@ -116,17 +125,20 @@ public function modifyMeta(array $meta)
116125
}
117126

118127
/**
119-
* {@inheritdoc}
128+
* @inheritdoc
120129
* @since 101.0.0
121130
*/
122131
public function modifyData(array $data)
123132
{
124-
return array_replace_recursive($data, [
125-
$this->locator->getProduct()->getId() => [
126-
self::DATA_SOURCE_DEFAULT => [
127-
'attribute_set_id' => $this->locator->getProduct()->getAttributeSetId()
128-
],
133+
return array_replace_recursive(
134+
$data,
135+
[
136+
$this->locator->getProduct()->getId() => [
137+
self::DATA_SOURCE_DEFAULT => [
138+
'attribute_set_id' => $this->locator->getProduct()->getAttributeSetId()
139+
],
140+
]
129141
]
130-
]);
142+
);
131143
}
132144
}

dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/SearchTest.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public function testExecuteNonExistingSearchKey() : void
3838
->setPostValue('limit', 50);
3939
$this->dispatch('backend/catalog/product/search');
4040
$responseBody = $this->getResponse()->getBody();
41-
$this->assertContains('{"options":[],"total":0}', $responseBody);
41+
$jsonResponse = json_decode($responseBody, true);
42+
$this->assertEmpty($jsonResponse['options']);
4243
}
4344

4445
/**
@@ -57,6 +58,24 @@ public function testExecuteNotVisibleIndividuallyProducts() : void
5758
->setPostValue('limit', 50);
5859
$this->dispatch('backend/catalog/product/search');
5960
$responseBody = $this->getResponse()->getBody();
60-
$this->assertContains('{"options":[],"total":0}', $responseBody);
61+
$jsonResponse = json_decode($responseBody, true);
62+
$this->assertEquals(1, $jsonResponse['total']);
63+
$this->assertCount(1, $jsonResponse['options']);
64+
}
65+
66+
/**
67+
* @magentoDataFixture Magento/Catalog/_files/multiple_mixed_products.php
68+
*/
69+
public function testExecuteEnabledAndDisabledProducts() : void
70+
{
71+
$this->getRequest()
72+
->setPostValue('searchKey', 'simple')
73+
->setPostValue('page', 1)
74+
->setPostValue('limit', 50);
75+
$this->dispatch('backend/catalog/product/search');
76+
$responseBody = $this->getResponse()->getBody();
77+
$jsonResponse = json_decode($responseBody, true);
78+
$this->assertEquals(7, $jsonResponse['total']);
79+
$this->assertCount(7, $jsonResponse['options']);
6180
}
6281
}

0 commit comments

Comments
 (0)