Skip to content

Commit 1314e5c

Browse files
committed
Issue 36208: Multiple Store views - Admin - Category page - Sorting by Product Name issue
1 parent fa3d6ec commit 1314e5c

File tree

1 file changed

+21
-1
lines changed
  • app/code/Magento/Catalog/Block/Adminhtml/Category/Tab

1 file changed

+21
-1
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
*
1010
* @author Magento Core Team <core@magentocommerce.com>
1111
*/
12+
declare(strict_types=1);
13+
1214
namespace Magento\Catalog\Block\Adminhtml\Category\Tab;
1315

1416
use Magento\Backend\Block\Widget\Grid;
@@ -18,10 +20,13 @@
1820
use Magento\Catalog\Model\Product\Visibility;
1921
use Magento\Framework\App\ObjectManager;
2022

23+
/**
24+
* Class Product in category grid
25+
*/
2126
class Product extends \Magento\Backend\Block\Widget\Grid\Extended
2227
{
2328
/**
24-
* Core registry
29+
* Core registry model
2530
*
2631
* @var \Magento\Framework\Registry
2732
*/
@@ -68,6 +73,8 @@ public function __construct(
6873
}
6974

7075
/**
76+
* Initialize object
77+
*
7178
* @return void
7279
*/
7380
protected function _construct()
@@ -79,6 +86,8 @@ protected function _construct()
7986
}
8087

8188
/**
89+
* Get current category
90+
*
8291
* @return array|null
8392
*/
8493
public function getCategory()
@@ -87,6 +96,8 @@ public function getCategory()
8796
}
8897

8998
/**
99+
* Add column filter to collection
100+
*
90101
* @param Column $column
91102
* @return $this
92103
*/
@@ -110,6 +121,8 @@ protected function _addColumnFilterToCollection($column)
110121
}
111122

112123
/**
124+
* Prepare collection.
125+
*
113126
* @return Grid
114127
*/
115128
protected function _prepareCollection()
@@ -136,6 +149,7 @@ protected function _prepareCollection()
136149
'left'
137150
);
138151
$storeId = (int)$this->getRequest()->getParam('store', 0);
152+
$collection->setStoreId($storeId);
139153
if ($storeId > 0) {
140154
$collection->addStoreFilter($storeId);
141155
}
@@ -153,6 +167,8 @@ protected function _prepareCollection()
153167
}
154168

155169
/**
170+
* Prepare columns.
171+
*
156172
* @return Extended
157173
*/
158174
protected function _prepareColumns()
@@ -230,6 +246,8 @@ protected function _prepareColumns()
230246
}
231247

232248
/**
249+
* Retrieve grid reload url
250+
*
233251
* @return string
234252
*/
235253
public function getGridUrl()
@@ -238,6 +256,8 @@ public function getGridUrl()
238256
}
239257

240258
/**
259+
* Get selected products
260+
*
241261
* @return array
242262
*/
243263
protected function _getSelectedProducts()

0 commit comments

Comments
 (0)