@@ -13,7 +13,7 @@ class Configuration extends Algolia implements CollectionDataSourceInterface
13
13
//Placeholder for future implementation (requires custom renderer for hierarchicalMenu widget)
14
14
private const IS_CATEGORY_NAVIGATION_ENABLED = false ;
15
15
16
- public function isSearchPage ()
16
+ public function isSearchPage (): bool
17
17
{
18
18
if ($ this ->getConfigHelper ()->isInstantEnabled ()) {
19
19
/** @var Http $request */
@@ -80,8 +80,6 @@ public function getConfiguration()
80
80
81
81
$ suggestionHelper = $ this ->getSuggestionHelper ();
82
82
83
- $ productHelper = $ this ->getProductHelper ();
84
-
85
83
$ algoliaHelper = $ this ->getAlgoliaHelper ();
86
84
87
85
$ persoHelper = $ this ->getPersonalizationHelper ();
@@ -254,7 +252,7 @@ public function getConfiguration()
254
252
'attributeFilter ' => $ attributesToFilter ,
255
253
'facets ' => $ facets ,
256
254
'areCategoriesInFacets ' => $ areCategoriesInFacets ,
257
- 'hitsPerPage ' => ( int ) $ config ->getNumberOfProductResults (),
255
+ 'hitsPerPage ' => $ config ->getNumberOfProductResults (),
258
256
'sortingIndices ' => array_values ($ this ->sortingTransformer ->getSortingIndices (
259
257
$ this ->getStoreId (),
260
258
$ customerGroupId
@@ -421,7 +419,7 @@ protected function getOrderedProductIds(ConfigHelper $configHelper, Http $reques
421
419
return $ ids ;
422
420
}
423
421
424
- protected function isLandingPage ()
422
+ protected function isLandingPage (): bool
425
423
{
426
424
return $ this ->getRequest ()->getFullActionName () === 'algolia_landingpage_view ' ;
427
425
}
@@ -440,4 +438,15 @@ protected function getLandingPageConfiguration()
440
438
{
441
439
return $ this ->isLandingPage () ? $ this ->getCurrentLandingPage ()->getConfiguration () : json_encode ([]);
442
440
}
441
+
442
+ public function canLoadInstantSearch (): bool
443
+ {
444
+ return $ this ->getConfigHelper ()->isInstantEnabled ()
445
+ && $ this ->isProductListingPage ();
446
+ }
447
+
448
+ protected function isProductListingPage (): bool
449
+ {
450
+ return $ this ->isSearchPage () || $ this ->isLandingPage ();
451
+ }
443
452
}
0 commit comments