File tree Expand file tree Collapse file tree 4 files changed +67
-0
lines changed
app/code/Magento/CatalogSearch
view/adminhtml/ui_component Expand file tree Collapse file tree 4 files changed +67
-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+
7+ namespace Magento \CatalogSearch \Ui \DataProvider \Product ;
8+
9+ use Magento \Framework \Data \Collection ;
10+ use Magento \CatalogSearch \Model \ResourceModel \Search \Collection as SearchCollection ;
11+ use Magento \Ui \DataProvider \AddFilterToCollectionInterface ;
12+
13+ /**
14+ * Class AddFulltextFilterToCollection
15+ */
16+ class AddFulltextFilterToCollection implements AddFilterToCollectionInterface
17+ {
18+ /**
19+ * Search Collection
20+ *
21+ * @var SearchCollection
22+ */
23+ private $ searchCollection ;
24+
25+ /**
26+ * @param SearchCollection $searchCollection
27+ */
28+ public function __construct (SearchCollection $ searchCollection )
29+ {
30+ $ this ->searchCollection = $ searchCollection ;
31+ }
32+
33+ /**
34+ * {@inheritdoc}
35+ *
36+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
37+ */
38+ public function addFilter (Collection $ collection , $ field , $ condition = null )
39+ {
40+ /** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
41+ if (isset ($ condition ['fulltext ' ]) && !empty ($ condition ['fulltext ' ])) {
42+ $ this ->searchCollection ->addBackendSearchFilter ($ condition ['fulltext ' ]);
43+ $ productIds = $ this ->searchCollection ->load ()->getAllIds ();
44+ $ collection ->addIdFilter ($ productIds );
45+ }
46+ }
47+ }
Original file line number Diff line number Diff line change 1212 "magento/module-eav" : " 101.0.*" ,
1313 "magento/module-backend" : " 100.2.*" ,
1414 "magento/module-theme" : " 100.2.*" ,
15+ "magento/module-ui" : " 101.0.*" ,
1516 "magento/module-catalog-inventory" : " 100.2.*" ,
1617 "magento/framework" : " 101.0.*"
1718 },
Original file line number Diff line number Diff line change 1919 <type name =" Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front" >
2020 <plugin name =" search_weigh" type =" Magento\CatalogSearch\Block\Plugin\FrontTabPlugin" />
2121 </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 >
2229</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