Skip to content

Commit c50b58d

Browse files
committed
Merge remote-tracking branch 'origin/MC-30734' into 2.4-develop-pr11
2 parents 61482bd + 871de8f commit c50b58d

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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\Catalog\Ui\Component\Listing\Columns;
9+
10+
/**
11+
* Attribute set listing column component
12+
*/
13+
class AttributeSetId extends \Magento\Ui\Component\Listing\Columns\Column
14+
{
15+
/**
16+
* @inheritDoc
17+
*/
18+
protected function applySorting()
19+
{
20+
$sorting = $this->getContext()->getRequestParam('sorting');
21+
$isSortable = $this->getData('config/sortable');
22+
if ($isSortable !== false
23+
&& !empty($sorting['field'])
24+
&& !empty($sorting['direction'])
25+
&& $sorting['field'] === $this->getName()
26+
) {
27+
$collection = $this->getContext()->getDataProvider()->getCollection();
28+
$collection->joinField(
29+
'attribute_set',
30+
'eav_attribute_set',
31+
'attribute_set_name',
32+
'attribute_set_id=attribute_set_id',
33+
null,
34+
'left'
35+
);
36+
$collection->getSelect()->order('attribute_set_name ' . $sorting['direction']);
37+
}
38+
}
39+
}

app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
<label translate="true">Type</label>
145145
</settings>
146146
</column>
147-
<column name="attribute_set_id" component="Magento_Ui/js/grid/columns/select" sortOrder="50">
147+
<column name="attribute_set_id" class="Magento\Catalog\Ui\Component\Listing\Columns\AttributeSetId" component="Magento_Ui/js/grid/columns/select" sortOrder="50">
148148
<settings>
149149
<options class="Magento\Catalog\Model\Product\AttributeSet\Options"/>
150150
<filter>select</filter>

0 commit comments

Comments
 (0)