-
Notifications
You must be signed in to change notification settings - Fork 164
/
ConfigHelper.php
executable file
·1885 lines (1724 loc) · 62.3 KB
/
ConfigHelper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
namespace Algolia\AlgoliaSearch\Helper;
use Algolia\AlgoliaSearch\Api\Product\ReplicaManagerInterface;
use Magento;
use Magento\Cookie\Helper\Cookie as CookieHelper;
use Magento\Directory\Model\Currency as DirCurrency;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\DataObject;
use Magento\Framework\Locale\Currency;
use Magento\Framework\Serialize\SerializerInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Customer\Api\GroupExcludedWebsiteRepositoryInterface;
use Magento\Customer\Model\ResourceModel\Group\Collection as GroupCollection;
class ConfigHelper
{
public const ENABLE_FRONTEND = 'algoliasearch_credentials/credentials/enable_frontend';
public const ENABLE_BACKEND = 'algoliasearch_credentials/credentials/enable_backend';
public const ENABLE_QUERY_SUGGESTIONS_INDEX = 'algoliasearch_credentials/credentials/enable_query_suggestions_index';
public const ENABLE_PAGES_INDEX = 'algoliasearch_credentials/credentials/enable_pages_index';
public const LOGGING_ENABLED = 'algoliasearch_credentials/credentials/debug';
public const APPLICATION_ID = 'algoliasearch_credentials/credentials/application_id';
public const API_KEY = 'algoliasearch_credentials/credentials/api_key';
public const SEARCH_ONLY_API_KEY = 'algoliasearch_credentials/credentials/search_only_api_key';
public const INDEX_PREFIX = 'algoliasearch_credentials/credentials/index_prefix';
public const COOKIE_DEFAULT_CONSENT_COOKIE_NAME = 'algoliasearch_credentials/algolia_cookie_configuration/default_consent_cookie_name';
public const ALLOW_COOKIE_BUTTON_SELECTOR = 'algoliasearch_credentials/algolia_cookie_configuration/allow_cookie_button_selector';
public const ALGOLIA_COOKIE_DURATION = 'algoliasearch_credentials/algolia_cookie_configuration/cookie_duration';
public const IS_INSTANT_ENABLED = 'algoliasearch_instant/instant/is_instant_enabled';
public const REPLACE_CATEGORIES = 'algoliasearch_instant/instant/replace_categories';
public const INSTANT_SELECTOR = 'algoliasearch_instant/instant/instant_selector';
public const NUMBER_OF_PRODUCT_RESULTS = 'algoliasearch_instant/instant/number_product_results';
public const FACETS = 'algoliasearch_instant/instant_facets/facets';
public const MAX_VALUES_PER_FACET = 'algoliasearch_instant/instant_facets/max_values_per_facet';
public const SORTING_INDICES = 'algoliasearch_instant/instant_sorts/sorts';
public const SEARCHBOX_ENABLE = 'algoliasearch_instant/instant_options/instantsearch_searchbox';
public const SHOW_SUGGESTIONS_NO_RESULTS = 'algoliasearch_instant/instant_options/show_suggestions_on_no_result_page';
public const XML_ADD_TO_CART_ENABLE = 'algoliasearch_instant/instant_options/add_to_cart_enable';
public const INFINITE_SCROLL_ENABLE = 'algoliasearch_instant/instant_options/infinite_scroll_enable';
public const HIDE_PAGINATION = 'algoliasearch_instant/instant_options/hide_pagination';
public const IS_POPUP_ENABLED = 'algoliasearch_autocomplete/autocomplete/is_popup_enabled';
public const NB_OF_PRODUCTS_SUGGESTIONS = 'algoliasearch_autocomplete/autocomplete/nb_of_products_suggestions';
public const NB_OF_CATEGORIES_SUGGESTIONS = 'algoliasearch_autocomplete/autocomplete/nb_of_categories_suggestions';
public const NB_OF_QUERIES_SUGGESTIONS = 'algoliasearch_autocomplete/autocomplete/nb_of_queries_suggestions';
public const AUTOCOMPLETE_SECTIONS = 'algoliasearch_autocomplete/autocomplete/sections';
public const EXCLUDED_PAGES = 'algoliasearch_autocomplete/autocomplete/excluded_pages';
public const MIN_POPULARITY = 'algoliasearch_autocomplete/autocomplete/min_popularity';
public const MIN_NUMBER_OF_RESULTS = 'algoliasearch_autocomplete/autocomplete/min_number_of_results';
public const RENDER_TEMPLATE_DIRECTIVES = 'algoliasearch_autocomplete/autocomplete/render_template_directives';
public const AUTOCOMPLETE_MENU_DEBUG = 'algoliasearch_autocomplete/autocomplete/debug';
public const AUTOCOMPLETE_DEBOUNCE_MILLISEC = 'algoliasearch_autocomplete/autocomplete/debounce_millisec';
public const AUTOCOMPLETE_MINIMUM_CHAR_LENGTH = 'algoliasearch_autocomplete/autocomplete/minimum_char_length';
public const PRODUCT_ATTRIBUTES = 'algoliasearch_products/products/product_additional_attributes';
public const PRODUCT_CUSTOM_RANKING = 'algoliasearch_products/products/custom_ranking_product_attributes';
public const USE_ADAPTIVE_IMAGE = 'algoliasearch_products/products/use_adaptive_image';
public const ENABLE_VISUAL_MERCHANDISING = 'algoliasearch_products/products/enable_visual_merchandising';
public const CATEGORY_PAGE_ID_ATTRIBUTE_NAME = 'algoliasearch_products/products/category_page_id_attribute_name';
public const CATEGORY_ATTRIBUTES = 'algoliasearch_categories/categories/category_additional_attributes';
public const CATEGORY_CUSTOM_RANKING = 'algoliasearch_categories/categories/custom_ranking_category_attributes';
public const SHOW_CATS_NOT_INCLUDED_IN_NAV = 'algoliasearch_categories/categories/show_cats_not_included_in_navigation';
public const INDEX_EMPTY_CATEGORIES = 'algoliasearch_categories/categories/index_empty_categories';
public const CATEGORY_SEPARATOR = 'algoliasearch_categories/categories/category_separator';
public const IS_ACTIVE = 'algoliasearch_queue/queue/active';
public const NUMBER_OF_JOB_TO_RUN = 'algoliasearch_queue/queue/number_of_job_to_run';
public const RETRY_LIMIT = 'algoliasearch_queue/queue/number_of_retries';
public const XML_PATH_IMAGE_WIDTH = 'algoliasearch_images/image/width';
public const XML_PATH_IMAGE_HEIGHT = 'algoliasearch_images/image/height';
public const XML_PATH_IMAGE_TYPE = 'algoliasearch_images/image/type';
public const CC_ANALYTICS_ENABLE = 'algoliasearch_cc_analytics/cc_analytics_group/enable';
public const CC_ANALYTICS_IS_SELECTOR = 'algoliasearch_cc_analytics/cc_analytics_group/is_selector';
public const CC_CONVERSION_ANALYTICS_MODE = 'algoliasearch_cc_analytics/cc_analytics_group/conversion_analytics_mode';
public const CC_ADD_TO_CART_SELECTOR = 'algoliasearch_cc_analytics/cc_analytics_group/add_to_cart_selector';
public const COOKIE_LIFETIME = 'web/cookie/cookie_lifetime';
public const GA_ENABLE = 'algoliasearch_analytics/analytics_group/enable';
public const GA_DELAY = 'algoliasearch_analytics/analytics_group/delay';
public const GA_TRIGGER_ON_UI_INTERACTION = 'algoliasearch_analytics/analytics_group/trigger_on_ui_interaction';
public const GA_PUSH_INITIAL_SEARCH = 'algoliasearch_analytics/analytics_group/push_initial_search';
public const REMOVE_IF_NO_RESULT = 'algoliasearch_advanced/advanced/remove_words_if_no_result';
public const PARTIAL_UPDATES = 'algoliasearch_advanced/advanced/partial_update';
public const CUSTOMER_GROUPS_ENABLE = 'algoliasearch_advanced/advanced/customer_groups_enable';
public const REMOVE_PUB_DIR_IN_URL = 'algoliasearch_advanced/advanced/remove_pub_dir_in_url';
public const MAKE_SEO_REQUEST = 'algoliasearch_advanced/advanced/make_seo_request';
public const REMOVE_BRANDING = 'algoliasearch_advanced/advanced/remove_branding';
public const AUTOCOMPLETE_SELECTOR = 'algoliasearch_autocomplete/autocomplete/autocomplete_selector';
public const INCLUDE_NON_VISIBLE_PRODUCTS_IN_INDEX = 'algoliasearch_products/products/include_non_visible_products_in_index';
public const IDX_PRODUCT_ON_CAT_PRODUCTS_UPD = 'algoliasearch_advanced/advanced/index_product_on_category_products_update';
public const PREVENT_BACKEND_RENDERING = 'algoliasearch_advanced/advanced/prevent_backend_rendering';
public const PREVENT_BACKEND_RENDERING_DISPLAY_MODE =
'algoliasearch_advanced/advanced/prevent_backend_rendering_display_mode';
public const BACKEND_RENDERING_ALLOWED_USER_AGENTS =
'algoliasearch_advanced/advanced/backend_rendering_allowed_user_agents';
public const NON_CASTABLE_ATTRIBUTES = 'algoliasearch_advanced/advanced/non_castable_attributes';
public const MAX_RECORD_SIZE_LIMIT = 'algoliasearch_advanced/advanced/max_record_size_limit';
public const ANALYTICS_REGION = 'algoliasearch_advanced/advanced/analytics_region';
public const CONNECTION_TIMEOUT = 'algoliasearch_advanced/advanced/connection_timeout';
public const READ_TIMEOUT = 'algoliasearch_advanced/advanced/read_timeout';
public const WRITE_TIMEOUT = 'algoliasearch_advanced/advanced/write_timeout';
public const SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock';
public const USE_SECURE_IN_FRONTEND = 'web/secure/use_in_frontend';
public const EXTRA_SETTINGS_PRODUCTS = 'algoliasearch_extra_settings/extra_settings/products_extra_settings';
public const EXTRA_SETTINGS_CATEGORIES = 'algoliasearch_extra_settings/extra_settings/categories_extra_settings';
public const EXTRA_SETTINGS_PAGES = 'algoliasearch_extra_settings/extra_settings/pages_extra_settings';
public const EXTRA_SETTINGS_SUGGESTIONS = 'algoliasearch_extra_settings/extra_settings/suggestions_extra_settings';
public const EXTRA_SETTINGS_ADDITIONAL_SECTIONS =
'algoliasearch_extra_settings/extra_settings/additional_sections_extra_settings';
public const MAGENTO_DEFAULT_CACHE_TIME = 'system/full_page_cache/ttl';
public const IS_RECOMMEND_FREQUENTLY_BOUGHT_TOGETHER_ENABLED = 'algoliasearch_recommend/recommend/frequently_bought_together/is_frequently_bought_together_enabled';
public const IS_RECOMMEND_RELATED_PRODUCTS_ENABLED = 'algoliasearch_recommend/recommend/related_product/is_related_products_enabled';
public const IS_RECOMMEND_FREQUENTLY_BOUGHT_TOGETHER_ENABLED_ON_CART_PAGE = 'algoliasearch_recommend/recommend/frequently_bought_together/is_frequently_bought_together_enabled_in_cart_page';
public const IS_RECOMMEND_RELATED_PRODUCTS_ENABLED_ON_CART_PAGE = 'algoliasearch_recommend/recommend/related_product/is_related_products_enabled_in_cart_page';
protected const NUM_OF_RECOMMEND_FREQUENTLY_BOUGHT_TOGETHER_PRODUCTS = 'algoliasearch_recommend/recommend/frequently_bought_together/num_of_frequently_bought_together_products';
protected const NUM_OF_RECOMMEND_RELATED_PRODUCTS = 'algoliasearch_recommend/recommend/related_product/num_of_related_products';
protected const IS_REMOVE_RELATED_PRODUCTS_BLOCK = 'algoliasearch_recommend/recommend/related_product/is_remove_core_related_products_block';
protected const IS_REMOVE_UPSELL_PRODUCTS_BLOCK = 'algoliasearch_recommend/recommend/frequently_bought_together/is_remove_core_upsell_products_block';
public const IS_RECOMMEND_TRENDING_ITEMS_ENABLED = 'algoliasearch_recommend/recommend/trends_item/is_trending_items_enabled';
protected const IS_RECOMMEND_LOOKING_SIMILAR_ENABLED = 'algoliasearch_recommend/recommend/looking_similar/is_looking_similar_enabled';
protected const NUM_OF_LOOKING_SIMILAR = 'algoliasearch_recommend/recommend/looking_similar/num_of_products';
protected const NUM_OF_TRENDING_ITEMS = 'algoliasearch_recommend/recommend/trends_item/num_of_trending_items';
protected const TREND_ITEMS_FACET_NAME = 'algoliasearch_recommend/recommend/trends_item/facet_name';
protected const TREND_ITEMS_FACET_VALUE = 'algoliasearch_recommend/recommend/trends_item/facet_value';
public const IS_TREND_ITEMS_ENABLED_IN_PDP = 'algoliasearch_recommend/recommend/trends_item/is_trending_items_enabled_on_pdp';
public const IS_TREND_ITEMS_ENABLED_IN_SHOPPING_CART = 'algoliasearch_recommend/recommend/trends_item/is_trending_items_enabled_on_cart_page';
protected const IS_ADDTOCART_ENABLED_IN_FREQUENTLY_BOUGHT_TOGETHER = 'algoliasearch_recommend/recommend/frequently_bought_together/is_addtocart_enabled';
protected const IS_ADDTOCART_ENABLED_IN_RELATED_PRODUCTS = 'algoliasearch_recommend/recommend/related_product/is_addtocart_enabled';
protected const IS_ADDTOCART_ENABLED_IN_TRENDS_ITEM = 'algoliasearch_recommend/recommend/trends_item/is_addtocart_enabled';
protected const IS_ADDTOCART_ENABLED_IN_LOOKING_SIMILAR = 'algoliasearch_recommend/recommend/looking_similar/is_addtocart_enabled';
public const IS_LOOKING_SIMILAR_ENABLED_IN_PDP = 'algoliasearch_recommend/recommend/looking_similar/is_looking_similar_enabled_on_pdp';
public const IS_LOOKING_SIMILAR_ENABLED_IN_SHOPPING_CART = 'algoliasearch_recommend/recommend/looking_similar/is_looking_similar_enabled_on_cart_page';
protected const LOOKING_SIMILAR_TITLE = 'algoliasearch_recommend/recommend/looking_similar/title';
public const LEGACY_USE_VIRTUAL_REPLICA_ENABLED = 'algoliasearch_instant/instant/use_virtual_replica';
protected const AUTOCOMPLETE_KEYBORAD_NAVIAGATION = 'algoliasearch_autocomplete/autocomplete/navigator';
protected const FREQUENTLY_BOUGHT_TOGETHER_TITLE = 'algoliasearch_recommend/recommend/frequently_bought_together/title';
protected const RELATED_PRODUCTS_TITLE = 'algoliasearch_recommend/recommend/related_product/title';
protected const TRENDING_ITEMS_TITLE = 'algoliasearch_recommend/recommend/trends_item/title';
// Indexing Queue Advanced settings
public const ENHANCED_QUEUE_ARCHIVE = 'algoliasearch_advanced/queue/enhanced_archive';
public const NUMBER_OF_ELEMENT_BY_PAGE = 'algoliasearch_advanced/queue/number_of_element_by_page';
public const ARCHIVE_LOG_CLEAR_LIMIT = 'algoliasearch_advanced/queue/archive_clear_limit';
public function __construct(
protected Magento\Framework\App\Config\ScopeConfigInterface $configInterface,
protected Magento\Framework\App\Config\Storage\WriterInterface $configWriter,
protected StoreManagerInterface $storeManager,
protected Currency $currency,
protected DirCurrency $dirCurrency,
protected DirectoryList $directoryList,
protected Magento\Framework\Module\ResourceInterface $moduleResource,
protected Magento\Framework\App\ProductMetadataInterface $productMetadata,
protected Magento\Framework\Event\ManagerInterface $eventManager,
protected SerializerInterface $serializer,
protected GroupCollection $groupCollection,
protected GroupExcludedWebsiteRepositoryInterface $groupExcludedWebsiteRepository,
protected CookieHelper $cookieHelper,
)
{}
/**
* @param $storeId
* @return bool
*/
public function showCatsNotIncludedInNavigation($storeId = null)
{
return $this->configInterface->isSetFlag(
self::SHOW_CATS_NOT_INCLUDED_IN_NAV,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return bool
*/
public function shouldIndexEmptyCategories($storeId = null)
{
return $this->configInterface->isSetFlag(self::INDEX_EMPTY_CATEGORIES, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @return string
*/
public function getMagentoVersion()
{
return $this->productMetadata->getVersion();
}
/**
* @return string
*/
public function getMagentoEdition()
{
return $this->productMetadata->getEdition();
}
/**
* @return false|string
*/
public function getExtensionVersion()
{
return $this->moduleResource->getDbVersion('Algolia_AlgoliaSearch');
}
/**
* @param $storeId
* @return bool
*/
public function isDefaultSelector($storeId = null)
{
return '.algolia-search-input' === $this->getAutocompleteSelector($storeId);
}
/**
* @param $storeId
* @return mixed
*/
public function getAutocompleteSelector($storeId = null)
{
return $this->configInterface->getValue(self::AUTOCOMPLETE_SELECTOR, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* Returns config flag
*
* @param $storeId
* @return bool
*/
public function includeNonVisibleProductsInIndex($storeId = null): bool
{
return $this->configInterface->isSetFlag(
self::INCLUDE_NON_VISIBLE_PRODUCTS_IN_INDEX,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return mixed
*/
public function indexProductOnCategoryProductsUpdate($storeId = null)
{
return $this->configInterface->getValue(
self::IDX_PRODUCT_ON_CAT_PRODUCTS_UPD,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return int
*/
public function getNumberOfQueriesSuggestions($storeId = null)
{
return (int)$this->configInterface->getValue(
self::NB_OF_QUERIES_SUGGESTIONS,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return int
*/
public function getNumberOfProductsSuggestions($storeId = null)
{
return (int)$this->configInterface->getValue(
self::NB_OF_PRODUCTS_SUGGESTIONS,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return int
*/
public function getNumberOfCategoriesSuggestions($storeId = null)
{
return (int)$this->configInterface->getValue(
self::NB_OF_CATEGORIES_SUGGESTIONS,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return bool
*/
public function isEnabledFrontEnd($storeId = null)
{
return $this->configInterface->isSetFlag(self::ENABLE_FRONTEND, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isEnabledBackend($storeId = null)
{
return $this->configInterface->isSetFlag(self::ENABLE_BACKEND, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function makeSeoRequest($storeId = null)
{
return $this->configInterface->isSetFlag(self::MAKE_SEO_REQUEST, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isLoggingEnabled($storeId = null)
{
return $this->configInterface->isSetFlag(self::LOGGING_ENABLED, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function getShowOutOfStock($storeId = null)
{
return $this->configInterface->isSetFlag(self::SHOW_OUT_OF_STOCK, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function useSecureUrlsInFrontend($storeId = null)
{
return $this->configInterface->isSetFlag(
self::USE_SECURE_IN_FRONTEND,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return int
*/
public function getImageWidth($storeId = null)
{
$imageWidth = $this->configInterface->getValue(
self::XML_PATH_IMAGE_WIDTH,
ScopeInterface::SCOPE_STORE,
$storeId
);
if (!$imageWidth) {
return 265;
}
return (int)$imageWidth;
}
/**
* @param $storeId
* @return int
*/
public function getImageHeight($storeId = null)
{
$imageHeight = $this->configInterface->getValue(
self::XML_PATH_IMAGE_HEIGHT,
ScopeInterface::SCOPE_STORE,
$storeId
);
if (!$imageHeight) {
return 265;
}
return (int)$imageHeight;
}
/**
* @param $storeId
* @return mixed
*/
public function getImageType($storeId = null)
{
return $this->configInterface->getValue(self::XML_PATH_IMAGE_TYPE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function shouldRemovePubDirectory($storeId = null)
{
return $this->configInterface->isSetFlag(self::REMOVE_PUB_DIR_IN_URL, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isPartialUpdateEnabled($storeId = null)
{
return $this->configInterface->isSetFlag(self::PARTIAL_UPDATES, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return array
*/
public function getAutocompleteSections($storeId = null)
{
$attrs = $this->unserialize($this->configInterface->getValue(
self::AUTOCOMPLETE_SECTIONS,
ScopeInterface::SCOPE_STORE,
$storeId
));
if (is_array($attrs)) {
return array_values($attrs);
}
return [];
}
protected function serialize(array $value): string {
return $this->serializer->serialize($value);
}
/**
* @param $value
* @return array|bool|float|int|mixed|string|null
*/
protected function unserialize($value)
{
if (false === $value || null === $value || '' === $value) {
return false;
}
$unserialized = json_decode($value, true);
if (json_last_error() === JSON_ERROR_NONE) {
return $unserialized;
}
return $this->serializer->unserialize($value);
}
/**
* @param $storeId
* @return int
*/
public function getMinPopularity($storeId = null)
{
return (int)$this->configInterface->getValue(self::MIN_POPULARITY, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return int
*/
public function getMinNumberOfResults($storeId = null)
{
return (int)$this->configInterface->getValue(self::MIN_NUMBER_OF_RESULTS, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isAddToCartEnable($storeId = null)
{
return $this->configInterface->isSetFlag(
self::XML_ADD_TO_CART_ENABLE,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return bool
*/
public function isInfiniteScrollEnabled($storeId = null)
{
return $this->isInstantEnabled($storeId)
&& $this->configInterface->isSetFlag(self::INFINITE_SCROLL_ENABLE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function hidePaginationInInstantSearchPage($storeId = null)
{
return $this->isInstantEnabled($storeId)
&& $this->configInterface->isSetFlag(self::HIDE_PAGINATION, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isInstantSearchBoxEnabled($storeId = null)
{
return $this->isInstantEnabled($storeId)
&& $this->configInterface->isSetFlag(self::SEARCHBOX_ENABLE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isInstantEnabled($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_INSTANT_ENABLED, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isRemoveBranding($storeId = null)
{
return $this->configInterface->isSetFlag(self::REMOVE_BRANDING, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return int
*/
public function getMaxValuesPerFacet($storeId = null)
{
return (int)$this->configInterface->getValue(self::MAX_VALUES_PER_FACET, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return int
*/
public function getNumberOfElementByPage($storeId = null)
{
return (int)$this->configInterface->getValue(self::NUMBER_OF_ELEMENT_BY_PAGE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return mixed
*/
public function getNumberOfJobToRun($storeId = null)
{
$nbJobs = (int)$this->configInterface->getValue(self::NUMBER_OF_JOB_TO_RUN, ScopeInterface::SCOPE_STORE, $storeId);
return max($nbJobs, 1);
}
/**
* @param $storeId
* @return int
*/
public function getRetryLimit($storeId = null)
{
return (int)$this->configInterface->getValue(self::RETRY_LIMIT, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isQueueActive($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_ACTIVE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isEnhancedQueueArchiveEnabled($storeId = null)
{
return $this->configInterface->isSetFlag(self::ENHANCED_QUEUE_ARCHIVE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return mixed
*/
public function getRemoveWordsIfNoResult($storeId = null)
{
return $this->configInterface->getValue(self::REMOVE_IF_NO_RESULT, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return int
*/
public function getNumberOfProductResults($storeId = null)
{
return (int)$this->configInterface->getValue(
self::NUMBER_OF_PRODUCT_RESULTS,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return bool
*/
public function replaceCategories($storeId = null)
{
return $this->configInterface->isSetFlag(self::REPLACE_CATEGORIES, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isAutoCompleteEnabled($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_POPUP_ENABLED, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isRecommendFrequentlyBroughtTogetherEnabled($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_RECOMMEND_FREQUENTLY_BOUGHT_TOGETHER_ENABLED, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isRecommendRelatedProductsEnabled($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_RECOMMEND_RELATED_PRODUCTS_ENABLED, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isRecommendFrequentlyBroughtTogetherEnabledOnCartPage($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_RECOMMEND_FREQUENTLY_BOUGHT_TOGETHER_ENABLED_ON_CART_PAGE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isRecommendRelatedProductsEnabledOnCartPage($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_RECOMMEND_RELATED_PRODUCTS_ENABLED_ON_CART_PAGE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isRemoveCoreRelatedProductsBlock($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_REMOVE_RELATED_PRODUCTS_BLOCK, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isRemoveUpsellProductsBlock($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_REMOVE_UPSELL_PRODUCTS_BLOCK, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return int
*/
public function getNumberOfRelatedProducts($storeId = null)
{
return (int)$this->configInterface->getValue(
self::NUM_OF_RECOMMEND_RELATED_PRODUCTS,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return int
*/
public function getNumberOfFrequentlyBoughtTogetherProducts($storeId = null)
{
return (int)$this->configInterface->getValue(
self::NUM_OF_RECOMMEND_FREQUENTLY_BOUGHT_TOGETHER_PRODUCTS,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param int $storeId
* @return int
*/
public function isRecommendTrendingItemsEnabled($storeId = null)
{
return (int)$this->configInterface->getValue(
self::IS_RECOMMEND_TRENDING_ITEMS_ENABLED,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return int
*/
public function getNumberOfTrendingItems($storeId = null)
{
return (int)$this->configInterface->getValue(
self::NUM_OF_TRENDING_ITEMS,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* Returns number of looking similar products to display
*
* @param $storeId
* @return int
*/
public function getNumberOfLookingSimilar($storeId = null)
{
return (int)$this->configInterface->getValue(
self::NUM_OF_LOOKING_SIMILAR,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return mixed
*/
public function getTrendingItemsFacetName($storeId = null)
{
return $this->configInterface->getValue(
self::TREND_ITEMS_FACET_NAME,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return mixed
*/
public function getTrendingItemsFacetValue($storeId = null)
{
return $this->configInterface->getValue(
self::TREND_ITEMS_FACET_VALUE,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* Determines whether Looking Similar enabled (for widgets))
*
* @param $storeId
* @return int
*/
public function isRecommendLookingSimilarEnabled($storeId = null)
{
return (int)$this->configInterface->getValue(
self::IS_RECOMMEND_LOOKING_SIMILAR_ENABLED,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* Determines whether Looking Similar enabled on PDP
*
* @param $storeId
* @return int
*/
public function isLookingSimilarEnabledInPDP($storeId = null)
{
return (int)$this->configInterface->getValue(
self::IS_LOOKING_SIMILAR_ENABLED_IN_PDP,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
public function getLookingSimilarTitle($storeId = null)
{
return $this->configInterface->getValue(
self::LOOKING_SIMILAR_TITLE,
ScopeInterface::SCOPE_STORE, $storeId
);
}
/**
* @param $storeId
* @return int
*/
public function isLookingSimilarEnabledInShoppingCart($storeId = null)
{
return (int)$this->configInterface->getValue(
self::IS_LOOKING_SIMILAR_ENABLED_IN_SHOPPING_CART,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return int
*/
public function isTrendItemsEnabledInPDP($storeId = null)
{
return (int)$this->configInterface->getValue(
self::IS_TREND_ITEMS_ENABLED_IN_PDP,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return int
*/
public function isTrendItemsEnabledInShoppingCart($storeId = null)
{
return (int)$this->configInterface->getValue(
self::IS_TREND_ITEMS_ENABLED_IN_SHOPPING_CART,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return bool
*/
public function isAddToCartEnabledInFrequentlyBoughtTogether($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_ADDTOCART_ENABLED_IN_FREQUENTLY_BOUGHT_TOGETHER, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isAddToCartEnabledInRelatedProducts($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_ADDTOCART_ENABLED_IN_RELATED_PRODUCTS, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isAddToCartEnabledInTrendsItem($storeId = null)
{
return $this->configInterface->isSetFlag(self::IS_ADDTOCART_ENABLED_IN_TRENDS_ITEM, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* Determines whether add to cart is enabled in Looking Similar
*
* @param $storeId
* @return bool
*/
public function isAddToCartEnabledInLookingSimilar($storeId = null)
{
return $this->configInterface->isSetFlag(
self::IS_ADDTOCART_ENABLED_IN_LOOKING_SIMILAR,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
* @param $storeId
* @return string
*/
public function getFBTTitle($storeId = null)
{
return $this->configInterface->getValue(self::FREQUENTLY_BOUGHT_TOGETHER_TITLE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return string
*/
public function getRelatedProductsTitle($storeId = null)
{
return $this->configInterface->getValue(self::RELATED_PRODUCTS_TITLE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return string
*/
public function getTrendingItemsTitle($storeId = null)
{
return $this->configInterface->getValue(self::TRENDING_ITEMS_TITLE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function useAdaptiveImage($storeId = null)
{
return $this->configInterface->isSetFlag(self::USE_ADAPTIVE_IMAGE, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return bool
*/
public function isVisualMerchEnabled($storeId = null): bool
{
return $this->configInterface->isSetFlag(self::ENABLE_VISUAL_MERCHANDISING, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return string
*/
public function getCategoryPageIdAttributeName($storeId = null): string
{
return (string) $this->configInterface->getValue(self::CATEGORY_PAGE_ID_ATTRIBUTE_NAME, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return mixed
*/
public function getInstantSelector($storeId = null)
{
return $this->configInterface->getValue(self::INSTANT_SELECTOR, ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param $storeId
* @return array
*/
public function getExcludedPages($storeId = null)
{
$attrs = $this->unserialize($this->configInterface->getValue(
self::EXCLUDED_PAGES,
ScopeInterface::SCOPE_STORE,
$storeId
));
if (is_array($attrs)) {
return $attrs;
}
return [];
}
/**
* @param $storeId
* @return mixed
*/
public function getRenderTemplateDirectives($storeId = null)
{
return $this->configInterface->getValue(
self::RENDER_TEMPLATE_DIRECTIVES,
ScopeInterface::SCOPE_STORE,
$storeId
);
}