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