Skip to content

Commit 5de8ff3

Browse files
committed
PB-107: Display total number of products matched into ProductsList
1 parent 93791a1 commit 5de8ff3

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

app/code/Magento/PageBuilder/Controller/Adminhtml/Form/Element/ProductTotals.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88

99
namespace Magento\PageBuilder\Controller\Adminhtml\Form\Element;
1010

11+
use Exception;
12+
use Magento\Backend\App\Action;
13+
use Magento\Backend\App\Action\Context;
1114
use Magento\Framework\App\Action\HttpPostActionInterface;
15+
use Magento\Framework\Controller\Result\JsonFactory;
1216

1317
/**
1418
* Returns the number of products that match the provided conditions
1519
*/
16-
class ProductTotals extends \Magento\Backend\App\Action implements HttpPostActionInterface
20+
class ProductTotals extends Action implements HttpPostActionInterface
1721
{
1822
const ADMIN_RESOURCE = 'Magento_Catalog::products';
1923

@@ -23,19 +27,19 @@ class ProductTotals extends \Magento\Backend\App\Action implements HttpPostActio
2327
private $productTotals;
2428

2529
/**
26-
* @var \Magento\Framework\Controller\Result\JsonFactory
30+
* @var JsonFactory
2731
*/
2832
private $jsonFactory;
2933

3034
/**
31-
* @param \Magento\Backend\App\Action\Context $context
35+
* @param Context $context
3236
* @param \Magento\PageBuilder\Model\Catalog\ProductTotals $productTotals
33-
* @param \Magento\Framework\Controller\Result\JsonFactory $jsonFactory
37+
* @param JsonFactory $jsonFactory
3438
*/
3539
public function __construct(
36-
\Magento\Backend\App\Action\Context $context,
40+
Context $context,
3741
\Magento\PageBuilder\Model\Catalog\ProductTotals $productTotals,
38-
\Magento\Framework\Controller\Result\JsonFactory $jsonFactory
42+
JsonFactory $jsonFactory
3943
) {
4044
$this->jsonFactory = $jsonFactory;
4145
$this->productTotals = $productTotals;
@@ -57,7 +61,7 @@ public function execute()
5761
'notVisible' => $totals['notVisible'],
5862
'outOfStock' => $totals['outOfStock'],
5963
];
60-
} catch (\Exception $e) {
64+
} catch (Exception $e) {
6165
$response = [
6266
'total' => 0,
6367
'disabled' => 0,

0 commit comments

Comments
 (0)