File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed
dev/tests/integration/testsuite/Magento/Weee/_files Expand file tree Collapse file tree 3 files changed +56
-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 \Weee \Ui \Component \Listing ;
9+
10+ use Magento \Catalog \Ui \Component \Listing \Attribute \Repository ;
11+ use Magento \Catalog \Ui \Component \Listing \Columns as DefaultColumns ;
12+ use Magento \Weee \Model \Attribute \Backend \Weee \Tax ;
13+
14+ /**
15+ * Class Columns
16+ */
17+ class Columns
18+ {
19+ /**
20+ * @var Repository
21+ */
22+ private $ attributeRepository ;
23+
24+ /**
25+ * @param Repository $attributeRepository
26+ */
27+ public function __construct (
28+ Repository $ attributeRepository
29+ ) {
30+ $ this ->attributeRepository = $ attributeRepository ;
31+ }
32+
33+ /**
34+ * Makes column for FPT attribute in grid not sortable
35+ *
36+ * @param DefaultColumns $subject
37+ */
38+ public function afterPrepare (DefaultColumns $ subject ) : void
39+ {
40+ foreach ($ this ->attributeRepository ->getList () as $ attribute ) {
41+ if ($ attribute ->getBackendModel () === Tax::class) {
42+ $ column = $ subject ->getComponent ($ attribute ->getAttributeCode ());
43+ $ columnConfig = $ column ->getData ('config ' );
44+ $ columnConfig ['sortable ' ] = false ;
45+ $ column ->setData ('config ' , $ columnConfig );
46+ }
47+ }
48+ }
49+ }
Original file line number Diff line number Diff line change 8484 <type name =" Magento\Catalog\Model\ResourceModel\Attribute\RemoveProductAttributeData" >
8585 <plugin name =" removeWeeAttributesData" type =" Magento\Weee\Plugin\Catalog\ResourceModel\Attribute\RemoveProductWeeData" />
8686 </type >
87+ <type name =" Magento\Catalog\Ui\Component\Listing\Columns" >
88+ <plugin name =" changeWeeColumnConfig" type =" Magento\Weee\Ui\Component\Listing\Columns" />
89+ </type >
8790</config >
Original file line number Diff line number Diff line change 66
77declare (strict_types=1 );
88
9+ use Magento \TestFramework \Workaround \Override \Fixture \Resolver ;
10+ Resolver::getInstance ()->requireDataFixture ('Magento/Weee/_files/fixed_product_attribute_rollback.php ' );
11+
912$ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
1013
1114/** @var \Magento\Eav\Model\Entity\Attribute\Set $attributeSet */
2730 'attribute_group_id ' => $ attributeGroupId ,
2831 'frontend_input ' => 'weee ' ,
2932 'frontend_label ' => 'fixed product tax ' ,
33+ 'is_used_in_grid ' => '1 ' ,
3034];
3135
3236/** @var \Magento\Catalog\Model\Entity\Attribute $attribute */
You can’t perform that action at this time.
0 commit comments