File tree Expand file tree Collapse file tree 5 files changed +48
-1
lines changed Expand file tree Collapse file tree 5 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ class ConfigHelper
108
108
public const CONNECTION_TIMEOUT = 'algoliasearch_advanced/advanced/connection_timeout ' ;
109
109
public const READ_TIMEOUT = 'algoliasearch_advanced/advanced/read_timeout ' ;
110
110
public const WRITE_TIMEOUT = 'algoliasearch_advanced/advanced/write_timeout ' ;
111
+ public const AUTO_PRICE_INDEXING_ENABLED = 'algoliasearch_advanced/advanced/auto_price_indexing ' ;
111
112
112
113
public const SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock ' ;
113
114
@@ -1272,6 +1273,15 @@ public function getWriteTimeout($storeId = null)
1272
1273
return $ this ->configInterface ->getValue (self ::WRITE_TIMEOUT , ScopeInterface::SCOPE_STORE , $ storeId );
1273
1274
}
1274
1275
1276
+ public function isAutoPriceIndexingEnabled (?int $ storeId = null ): bool
1277
+ {
1278
+ return $ this ->configInterface ->isSetFlag (
1279
+ self ::AUTO_PRICE_INDEXING_ENABLED ,
1280
+ ScopeInterface::SCOPE_STORE ,
1281
+ $ storeId
1282
+ );
1283
+ }
1284
+
1275
1285
/**
1276
1286
* @param $storeId
1277
1287
* @return array|bool|float|int|mixed|string
Original file line number Diff line number Diff line change @@ -713,7 +713,9 @@ public function rebuildStoreProductIndexPage(
713
713
]
714
714
);
715
715
716
- $ this ->missingPriceIndexHandler ->refreshPriceIndex ($ collection );
716
+ if ($ this ->configHelper ->isAutoPriceIndexingEnabled ($ storeId )) {
717
+ $ this ->missingPriceIndexHandler ->refreshPriceIndex ($ collection );
718
+ }
717
719
718
720
$ logMessage = 'LOADING: ' . $ this ->logger ->getStoreName ($ storeId ) . ',
719
721
collection page: ' . $ page . ',
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Algolia \AlgoliaSearch \Model \Config ;
4
+
5
+ use Magento \Config \Model \Config \CommentInterface ;
6
+ use Magento \Framework \UrlInterface ;
7
+
8
+ class AutomaticPriceIndexingComment implements CommentInterface
9
+ {
10
+ public function __construct (
11
+ protected UrlInterface $ urlInterface
12
+ ) { }
13
+
14
+ public function getCommentText ($ elementValue )
15
+ {
16
+ $ url = $ this ->urlInterface ->getUrl ('https://www.algolia.com/doc/integration/magento-2/how-it-works/indexing-queue/#configure-the-queue ' );
17
+
18
+ $ comment = array ();
19
+ $ comment [] = 'Algolia relies on the core Magento Product Price index when serializing product data. If the price index is not up to date, Algolia will not be able to accurately determine what should be included in the search index. ' ;
20
+ $ comment [] = 'If you are experiencing problems with products not syncing to Algolia due to this issue, enabling this setting will allow Algolia to automatically update the price index as needed. ' ;
21
+ $ comment [] = 'NOTE: This can introduce a marginal amount of overhead to the indexing process so only enable if necessary. Be sure to <a href=" ' . $ url . '" target="_blank">optimize the indexing queue</a> based on the impact of this operation. ' ;
22
+ return implode ('<br><br> ' , $ comment );
23
+ }
24
+ }
Original file line number Diff line number Diff line change 1337
1337
<field id =" write_timeout" translate =" label comment" type =" text" sortOrder =" 110" showInDefault =" 1" >
1338
1338
<label >Write Timeout (In Seconds)</label >
1339
1339
</field >
1340
+ <field id =" auto_price_indexing" translate =" label comment" type =" select" sortOrder =" 120" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
1341
+ <label >Enable automatic price indexing</label >
1342
+ <source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
1343
+ <comment >
1344
+ <model >Algolia\AlgoliaSearch\Model\Config\AutomaticPriceIndexingComment</model >
1345
+ </comment >
1346
+ <depends >
1347
+ <field id =" active" >1</field >
1348
+ </depends >
1349
+ </field >
1340
1350
</group >
1341
1351
<group id =" queue" translate =" label" type =" text" sortOrder =" 20" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
1342
1352
<label >Indexing Queue</label >
Original file line number Diff line number Diff line change 94
94
<connection_timeout >2</connection_timeout >
95
95
<read_timeout >30</read_timeout >
96
96
<write_timeout >30</write_timeout >
97
+ <auto_price_indexing >0</auto_price_indexing >
97
98
</advanced >
98
99
<queue >
99
100
<number_of_element_by_page >300</number_of_element_by_page >
You can’t perform that action at this time.
0 commit comments