10
10
use Algolia \AlgoliaSearch \Helper \Entity \ProductHelper ;
11
11
use Algolia \AlgoliaSearch \Helper \Entity \SuggestionHelper ;
12
12
use Algolia \AlgoliaSearch \Helper \LandingPageHelper ;
13
+ use Algolia \AlgoliaSearch \Registry \CurrentCategory ;
13
14
use Magento \Catalog \Model \Product ;
14
15
use Magento \Checkout \Model \Session as CheckoutSession ;
15
16
use Magento \Customer \Model \Context as CustomerContext ;
@@ -97,6 +98,9 @@ class Algolia extends Template implements CollectionDataSourceInterface
97
98
*/
98
99
protected $ date ;
99
100
101
+ /** @var CurrentCategory */
102
+ protected CurrentCategory $ currentCategory ;
103
+
100
104
protected $ priceKey ;
101
105
102
106
/**
@@ -139,6 +143,7 @@ public function __construct(
139
143
PersonalizationHelper $ personalizationHelper ,
140
144
CheckoutSession $ checkoutSession ,
141
145
DateTime $ date ,
146
+ CurrentCategory $ currentCategory ,
142
147
array $ data = []
143
148
) {
144
149
$ this ->config = $ config ;
@@ -158,6 +163,7 @@ public function __construct(
158
163
$ this ->personalizationHelper = $ personalizationHelper ;
159
164
$ this ->checkoutSession = $ checkoutSession ;
160
165
$ this ->date = $ date ;
166
+ $ this ->currentCategory = $ currentCategory ;
161
167
162
168
parent ::__construct ($ context , $ data );
163
169
}
@@ -255,7 +261,7 @@ public function getStoreId()
255
261
256
262
public function getCurrentCategory ()
257
263
{
258
- return $ this ->registry -> registry ( ' current_category ' );
264
+ return $ this ->currentCategory -> get ( );
259
265
}
260
266
261
267
/** @return Product */
0 commit comments