Skip to content

Commit 4c5a130

Browse files
Chandresh22engcom-Charlie
authored andcommitted
Update ReviewDataProvider.php
1 parent a92dee7 commit 4c5a130

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

app/code/Magento/Review/Ui/DataProvider/Product/ReviewDataProvider.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Magento\Review\Model\Review;
1313

1414
/**
15-
* Class ReviewDataProvider
15+
* DataProvider Product ReviewDataProvider
1616
*
1717
* @api
1818
*
@@ -58,14 +58,22 @@ public function __construct(
5858
}
5959

6060
/**
61-
* {@inheritdoc}
61+
* @inheritdoc
6262
* @since 100.1.0
6363
*/
6464
public function getData()
6565
{
6666
$this->getCollection()->addEntityFilter($this->request->getParam('current_product_id', 0))
6767
->addStoreData();
6868

69+
$params = $this->request->getParams();
70+
if (isset($params['sorting'])) {
71+
$sorting = $params['sorting'];
72+
$field = $sorting['field'];
73+
$direction = $sorting['direction'];
74+
$this->getCollection()->getSelect()->order($field . ' ' . $direction);
75+
}
76+
6977
$arrItems = [
7078
'totalRecords' => $this->getCollection()->getSize(),
7179
'items' => [],
@@ -79,7 +87,7 @@ public function getData()
7987
}
8088

8189
/**
82-
* {@inheritdoc}
90+
* @inheritdoc
8391
* @since 100.1.0
8492
*/
8593
public function addFilter(\Magento\Framework\Api\Filter $filter)

0 commit comments

Comments
 (0)