File tree Expand file tree Collapse file tree 4 files changed +66
-0
lines changed
app/code/Magento/CatalogSearch
view/adminhtml/ui_component Expand file tree Collapse file tree 4 files changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \CatalogSearch \Ui \DataProvider \Product ;
7
+
8
+ use Magento \Framework \Data \Collection ;
9
+ use Magento \CatalogSearch \Model \ResourceModel \Search \Collection as SearchCollection ;
10
+ use Magento \Ui \DataProvider \AddFilterToCollectionInterface ;
11
+
12
+ /**
13
+ * Class AddFulltextFilterToCollection
14
+ */
15
+ class AddFulltextFilterToCollection implements AddFilterToCollectionInterface
16
+ {
17
+ /**
18
+ * Search Collection
19
+ *
20
+ * @var SearchCollection
21
+ */
22
+ private $ searchCollection ;
23
+
24
+ /**
25
+ * @param SearchCollection $searchCollection
26
+ */
27
+ public function __construct (SearchCollection $ searchCollection )
28
+ {
29
+ $ this ->searchCollection = $ searchCollection ;
30
+ }
31
+
32
+ /**
33
+ * {@inheritdoc}
34
+ *
35
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
36
+ */
37
+ public function addFilter (Collection $ collection , $ field , $ condition = null )
38
+ {
39
+ /** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
40
+ if (isset ($ condition ['fulltext ' ]) && !empty ($ condition ['fulltext ' ])) {
41
+ $ this ->searchCollection ->addBackendSearchFilter ($ condition ['fulltext ' ]);
42
+ $ productIds = $ this ->searchCollection ->load ()->getAllIds ();
43
+ $ collection ->addIdFilter ($ productIds );
44
+ }
45
+ }
46
+ }
Original file line number Diff line number Diff line change 11
11
"magento/module-eav" : " 100.2.*" ,
12
12
"magento/module-backend" : " 100.2.*" ,
13
13
"magento/module-theme" : " 100.2.*" ,
14
+ "magento/module-ui" : " 100.2.*" ,
14
15
"magento/module-catalog-inventory" : " 100.2.*" ,
15
16
"magento/framework" : " 100.2.*"
16
17
},
Original file line number Diff line number Diff line change 19
19
<type name =" Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front" >
20
20
<plugin name =" search_weigh" type =" Magento\CatalogSearch\Block\Plugin\FrontTabPlugin" />
21
21
</type >
22
+ <type name =" Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider" >
23
+ <arguments >
24
+ <argument name =" addFilterStrategies" xsi : type =" array" >
25
+ <item name =" fulltext" xsi : type =" object" >Magento\CatalogSearch\Ui\DataProvider\Product\AddFulltextFilterToCollection</item >
26
+ </argument >
27
+ </arguments >
28
+ </type >
22
29
</config >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+ <listing xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:module:Magento_Ui:etc/ui_configuration.xsd" >
9
+ <listingToolbar name =" listing_top" >
10
+ <filterSearch name =" fulltext" />
11
+ </listingToolbar >
12
+ </listing >
You can’t perform that action at this time.
0 commit comments