9
9
use Magento \Framework \DataObject \IdentityInterface ;
10
10
use Magento \Widget \Block \BlockInterface ;
11
11
use Magento \Framework \Pricing \PriceCurrencyInterface ;
12
+ use Magento \Framework \App \ObjectManager ;
13
+ use Magento \Framework \Serialize \Serializer \Json ;
12
14
13
15
/**
14
16
* Catalog Products List widget block
@@ -85,6 +87,13 @@ class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implem
85
87
*/
86
88
private $ priceCurrency ;
87
89
90
+ /**
91
+ * Json Serializer Instance
92
+ *
93
+ * @var Json
94
+ */
95
+ private $ json ;
96
+
88
97
/**
89
98
* @param \Magento\Catalog\Block\Product\Context $context
90
99
* @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory
@@ -94,6 +103,7 @@ class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implem
94
103
* @param \Magento\CatalogWidget\Model\Rule $rule
95
104
* @param \Magento\Widget\Helper\Conditions $conditionsHelper
96
105
* @param array $data
106
+ * @param Json|null $json
97
107
*/
98
108
public function __construct (
99
109
\Magento \Catalog \Block \Product \Context $ context ,
@@ -103,14 +113,16 @@ public function __construct(
103
113
\Magento \Rule \Model \Condition \Sql \Builder $ sqlBuilder ,
104
114
\Magento \CatalogWidget \Model \Rule $ rule ,
105
115
\Magento \Widget \Helper \Conditions $ conditionsHelper ,
106
- array $ data = []
116
+ array $ data = [],
117
+ Json $ json = null
107
118
) {
108
119
$ this ->productCollectionFactory = $ productCollectionFactory ;
109
120
$ this ->catalogProductVisibility = $ catalogProductVisibility ;
110
121
$ this ->httpContext = $ httpContext ;
111
122
$ this ->sqlBuilder = $ sqlBuilder ;
112
123
$ this ->rule = $ rule ;
113
124
$ this ->conditionsHelper = $ conditionsHelper ;
125
+ $ this ->json = $ json ?: ObjectManager::getInstance ()->get (Json::class);
114
126
parent ::__construct (
115
127
$ context ,
116
128
$ data
@@ -155,7 +167,7 @@ public function getCacheKeyInfo()
155
167
intval ($ this ->getRequest ()->getParam ($ this ->getData ('page_var_name ' ), 1 )),
156
168
$ this ->getProductsPerPage (),
157
169
$ conditions ,
158
- serialize ($ this ->getRequest ()->getParams ())
170
+ $ this -> json -> serialize ($ this ->getRequest ()->getParams ())
159
171
];
160
172
}
161
173
0 commit comments