File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
app/code/Magento/ConfigurableProduct Expand file tree Collapse file tree 2 files changed +41
-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
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \ConfigurableProduct \Plugin \Model ;
9
+
10
+ use Magento \ConfigurableProduct \Ui \DataProvider \Attributes ;
11
+
12
+ /**
13
+ * Update configurable product attribute collection.
14
+ */
15
+ class UpdateConfigurableProductAttributeCollection
16
+ {
17
+ /**
18
+ * Adding a field to filter in existing configurable product attribute collection.
19
+ *
20
+ * @param Attributes $subject
21
+ * @return object
22
+ */
23
+ public function beforeGetData (Attributes $ subject ): object
24
+ {
25
+ $ types = [
26
+ \Magento \Catalog \Model \Product \Type::TYPE_SIMPLE ,
27
+ \Magento \Catalog \Model \Product \Type::TYPE_VIRTUAL ,
28
+ \Magento \ConfigurableProduct \Model \Product \Type \Configurable::TYPE_CODE ,
29
+ ];
30
+ return $ subject ->getCollection ()->addFieldToFilter (
31
+ ['apply_to ' , 'apply_to ' ],
32
+ [
33
+ ['null ' => true ],
34
+ ['like ' => '% ' . implode (', ' , $ types ) . '% ' ]
35
+ ]
36
+ );
37
+ }
38
+ }
Original file line number Diff line number Diff line change 81
81
<type name =" Magento\Sales\Model\Order\Invoice" >
82
82
<plugin name =" update_configurable_product_total_qty" type =" Magento\ConfigurableProduct\Plugin\Model\Order\Invoice\UpdateConfigurableProductTotalQty" />
83
83
</type >
84
+ <type name =" Magento\ConfigurableProduct\Ui\DataProvider\Attributes" >
85
+ <plugin name =" update_configurable_product_attribute_collection" type =" Magento\ConfigurableProduct\Plugin\Model\UpdateConfigurableProductAttributeCollection" />
86
+ </type >
84
87
</config >
You can’t perform that action at this time.
0 commit comments