File tree Expand file tree Collapse file tree 4 files changed +38
-23
lines changed Expand file tree Collapse file tree 4 files changed +38
-23
lines changed Original file line number Diff line number Diff line change 5
5
use Algolia \AlgoliaSearch \Helper \AlgoliaHelper ;
6
6
use Algolia \AlgoliaSearch \Helper \ConfigHelper ;
7
7
use Algolia \AlgoliaSearch \Helper \Configuration \AutocompleteHelper ;
8
+ use Algolia \AlgoliaSearch \Helper \Configuration \InstantSearchHelper ;
8
9
use Algolia \AlgoliaSearch \Helper \Configuration \PersonalizationHelper ;
9
10
use Algolia \AlgoliaSearch \Helper \Data as CoreHelper ;
10
11
use Algolia \AlgoliaSearch \Helper \Entity \CategoryHelper ;
@@ -42,6 +43,7 @@ class Algolia extends Template implements CollectionDataSourceInterface
42
43
public function __construct (
43
44
protected ConfigHelper $ config ,
44
45
protected AutocompleteHelper $ autocompleteConfig ,
46
+ protected InstantSearchHelper $ instantSearchConfig ,
45
47
protected PersonalizationHelper $ personalizationHelper ,
46
48
protected CatalogSearchHelper $ catalogSearchHelper ,
47
49
protected ProductHelper $ productHelper ,
Original file line number Diff line number Diff line change @@ -202,11 +202,11 @@ public function getConfiguration()
202
202
'hidePagination ' => $ config ->hidePaginationInInstantSearchPage (),
203
203
'isDynamicFacetsEnabled ' => $ config ->isDynamicFacetsEnabled (),
204
204
'redirects ' => [
205
- 'enabled ' => $ config ->isInstantRedirectEnabled (),
206
- 'onPageLoad ' => in_array (InstantSearchRedirectOptions::REDIRECT_ON_PAGE_LOAD , $ config ->getInstantRedirectOptions ()),
207
- 'onSearchAsYouType ' => in_array (InstantSearchRedirectOptions::REDIRECT_ON_SEARCH_AS_YOU_TYPE , $ config ->getInstantRedirectOptions ()),
208
- 'showSelectableRedirect ' => in_array (InstantSearchRedirectOptions::SELECTABLE_REDIRECT , $ config ->getInstantRedirectOptions ()),
209
- 'openInNewWindow ' => in_array (InstantSearchRedirectOptions::OPEN_IN_NEW_WINDOW , $ config ->getInstantRedirectOptions ())
205
+ 'enabled ' => $ this -> instantSearchConfig ->isInstantRedirectEnabled (),
206
+ 'onPageLoad ' => in_array (InstantSearchRedirectOptions::REDIRECT_ON_PAGE_LOAD , $ this -> instantSearchConfig ->getInstantRedirectOptions ()),
207
+ 'onSearchAsYouType ' => in_array (InstantSearchRedirectOptions::REDIRECT_ON_SEARCH_AS_YOU_TYPE , $ this -> instantSearchConfig ->getInstantRedirectOptions ()),
208
+ 'showSelectableRedirect ' => in_array (InstantSearchRedirectOptions::SELECTABLE_REDIRECT , $ this -> instantSearchConfig ->getInstantRedirectOptions ()),
209
+ 'openInNewWindow ' => in_array (InstantSearchRedirectOptions::OPEN_IN_NEW_WINDOW , $ this -> instantSearchConfig ->getInstantRedirectOptions ())
210
210
]
211
211
],
212
212
'autocomplete ' => [
Original file line number Diff line number Diff line change @@ -47,9 +47,6 @@ class ConfigHelper
47
47
public const INFINITE_SCROLL_ENABLE = 'algoliasearch_instant/instant_options/infinite_scroll_enable ' ;
48
48
public const HIDE_PAGINATION = 'algoliasearch_instant/instant_options/hide_pagination ' ;
49
49
50
- public const IS_INSTANT_REDIRECT_ENABLED = 'algoliasearch_instant/instant_redirects/enable ' ;
51
- public const INSTANT_REDIRECT_OPTIONS = 'algoliasearch_instant/instant_redirects/options ' ;
52
-
53
50
public const IS_POPUP_ENABLED = 'algoliasearch_autocomplete/autocomplete/is_popup_enabled ' ;
54
51
public const NB_OF_PRODUCTS_SUGGESTIONS = 'algoliasearch_autocomplete/autocomplete/nb_of_products_suggestions ' ;
55
52
public const NB_OF_CATEGORIES_SUGGESTIONS = 'algoliasearch_autocomplete/autocomplete/nb_of_categories_suggestions ' ;
@@ -1063,21 +1060,6 @@ public function getAutocompleteMinimumCharacterLength(?int $storeId = null): int
1063
1060
);
1064
1061
}
1065
1062
1066
- public function isInstantRedirectEnabled (?int $ storeId = null ): bool
1067
- {
1068
- return $ this ->configInterface ->isSetFlag (self ::IS_INSTANT_REDIRECT_ENABLED , ScopeInterface::SCOPE_STORE , $ storeId );
1069
- }
1070
-
1071
- public function getInstantRedirectOptions (?int $ storeId = null ): array
1072
- {
1073
- $ value = $ this ->configInterface ->getValue (
1074
- self ::INSTANT_REDIRECT_OPTIONS ,
1075
- ScopeInterface::SCOPE_STORE ,
1076
- $ storeId
1077
- );
1078
- return empty ($ value ) ? [] : explode (', ' , $ value );
1079
- }
1080
-
1081
1063
/**
1082
1064
* @param $originalIndexName
1083
1065
* @param $storeId
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Algolia \AlgoliaSearch \Helper \Configuration ;
4
+
5
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
6
+ use Magento \Store \Model \ScopeInterface ;
7
+
8
+ class InstantSearchHelper
9
+ {
10
+ public const IS_INSTANT_REDIRECT_ENABLED = 'algoliasearch_instant/instant_redirects/enable ' ;
11
+ public const INSTANT_REDIRECT_OPTIONS = 'algoliasearch_instant/instant_redirects/options ' ;
12
+
13
+ public function __construct (
14
+ protected ScopeConfigInterface $ configInterface ,
15
+ ) {}
16
+
17
+ public function isInstantRedirectEnabled (?int $ storeId = null ): bool
18
+ {
19
+ return $ this ->configInterface ->isSetFlag (self ::IS_INSTANT_REDIRECT_ENABLED , ScopeInterface::SCOPE_STORE , $ storeId );
20
+ }
21
+
22
+ public function getInstantRedirectOptions (?int $ storeId = null ): array
23
+ {
24
+ $ value = $ this ->configInterface ->getValue (
25
+ self ::INSTANT_REDIRECT_OPTIONS ,
26
+ ScopeInterface::SCOPE_STORE ,
27
+ $ storeId
28
+ );
29
+ return empty ($ value ) ? [] : explode (', ' , $ value );
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments