From 4c0dde8ed6d825681b882e3914715b9d0ea586f3 Mon Sep 17 00:00:00 2001 From: makso8makso <igor.maksimovic@soprex.com> Date: Wed, 27 Nov 2024 10:39:49 +0100 Subject: [PATCH] create a mechanism, added a warning on adminhtml panel --- Helper/Data.php | 54 +++++++++- Model/Config/Backend/MultiIndexer.php | 100 ++++++++++++++++++ Model/Config/Source/MultiIndexer.php | 62 +++++++++++ Model/Config/Source/WebsitePublicity.php | 33 ++++++ Model/Indexer/LightProductIndexer.php | 13 ++- Model/Indexer/ProductIndexer.php | 22 ++-- Model/Service/AbstractService.php | 2 +- Model/Service/Sync/Recrawl/RecrawlService.php | 18 ++-- Model/Service/Sync/Upsert/SyncService.php | 2 +- composer.json | 2 +- etc/adminhtml/system.xml | 83 ++++++++++----- etc/config.xml | 9 +- 12 files changed, 348 insertions(+), 52 deletions(-) create mode 100644 Model/Config/Backend/MultiIndexer.php create mode 100644 Model/Config/Source/MultiIndexer.php create mode 100644 Model/Config/Source/WebsitePublicity.php diff --git a/Helper/Data.php b/Helper/Data.php index b84ec85ae..eceff1ff3 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -179,9 +179,9 @@ class Data extends AbstractHelper public const XML_PATH_MULTI_CURRENCY = 'nosto/multicurrency/method'; /** - * Path to the configuration object for light indexer + * Path to the configuration object for multi currency */ - public const XML_PATH_USE_LIGHT_INDEXER = 'nosto/flags/use_light_indexer'; + public const XML_PATH_MULTI_INDEXER = 'nosto/product_sync/indexer_method'; /** * @var string Nosto customer reference attribute name @@ -203,6 +203,14 @@ class Data extends AbstractHelper public const SETTING_VALUE_MC_DISABLED = 'disabled'; public const SETTING_VALUE_MC_UNDEFINED = 'undefined'; + /** + * Values of the multi indexer settings + */ + public const SETTING_VALUE_MI_PRODUCT_INDEXER = 'productindexer'; + public const SETTING_VALUE_MI_PRODUCT_LIGHT_INDEXER = 'productlightindexer'; + public const SETTING_VALUE_MI_PRODUCT_DISABLED = 'disabled'; + public const SETTING_VALUE_MI_UNDEFINDED = 'undefined'; + /** * Name of the module */ @@ -542,14 +550,50 @@ public function getMultiCurrencyMethod(StoreInterface $store = null) } /** - * Returns if the light indexer should be used + * Returns if multi indexer is disabled + * + * @param StoreInterface|null $store the store model or null. + * @return bool the configuration value + */ + public function isMultiIndexerDisabled(StoreInterface $store = null) + { + $storeConfig = $this->getMultiIndexerMethod($store); + return ($storeConfig === self::SETTING_VALUE_MI_PRODUCT_DISABLED); + } + + /** + * Returns if multi indexer is enabled + * + * @param StoreInterface|null $store the store model or null. + * @return bool the configuration value + */ + public function isMultiIndexerMainIndexerEnabled(StoreInterface $store = null) + { + $storeConfig = $this->getMultiIndexerMethod($store); + return ($storeConfig === self::SETTING_VALUE_MI_PRODUCT_INDEXER); + } + + /** + * Returns if multi indexer is enabled + * + * @param StoreInterface|null $store the store model or null. + * @return bool the configuration value + */ + public function isMultiIndexerLightIndexerEnabled(StoreInterface $store = null) + { + $storeConfig = $this->getMultiIndexerMethod($store); + return ($storeConfig === self::SETTING_VALUE_MI_PRODUCT_LIGHT_INDEXER); + } + + /** + * Returns the multi indexer setup value / multi indexer_method * * @param StoreInterface|null $store the store model or null. * @return string the configuration value */ - public function getUseLightIndexer(StoreInterface $store = null) + public function getMultiIndexerMethod(StoreInterface $store = null) { - return $this->getStoreConfig(self::XML_PATH_USE_LIGHT_INDEXER, $store); + return $this->getStoreConfig(self::XML_PATH_MULTI_INDEXER, $store); } /** diff --git a/Model/Config/Backend/MultiIndexer.php b/Model/Config/Backend/MultiIndexer.php new file mode 100644 index 000000000..69646a167 --- /dev/null +++ b/Model/Config/Backend/MultiIndexer.php @@ -0,0 +1,100 @@ +<?php +/** + * Copyright (c) 2020, Nosto Solutions Ltd + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @author Nosto Solutions Ltd <contact@nosto.com> + * @copyright 2020 Nosto Solutions Ltd + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause + * + */ + +namespace Nosto\Tagging\Model\Config\Backend; + +use Magento\Framework\App\Cache\TypeListInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\Config\Storage\WriterInterface; +use Magento\Framework\App\Config\Value; +use Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\Model\Context; +use Magento\Framework\Model\ResourceModel\AbstractResource; +use Magento\Framework\Registry; +use Nosto\Tagging\Helper\Data as NostoHelperData; + +class MultiIndexer extends Value +{ + private WriterInterface $configWriter; + + /** + * MultiCurrency constructor. + * @param Context $context + * @param Registry $registry + * @param ScopeConfigInterface $config + * @param TypeListInterface $cacheTypeList + * @param WriterInterface $configWriter + * @param AbstractResource|null $resource + * @param AbstractDb|null $resourceCollection + * @param array $data + */ + public function __construct( + Context $context, + Registry $registry, + ScopeConfigInterface $config, + TypeListInterface $cacheTypeList, + WriterInterface $configWriter, + AbstractResource $resource = null, + AbstractDb $resourceCollection = null, + array $data = [] + ) { + $this->configWriter = $configWriter; + parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data); + } + + /** + * @return Value + */ + public function beforeSave() //@codingStandardsIgnoreLine + { + $value = $this->getValue(); + $scopeType = $this->getScope(); + $scopeId = $this->getScopeId(); + + if ($value == NostoHelperData::SETTING_VALUE_MI_PRODUCT_INDEXER + || $value == NostoHelperData::SETTING_VALUE_MI_PRODUCT_LIGHT_INDEXER + ) { +// $this->configWriter->save( +// NostoHelperData::XML_PATH_PRICING_VARIATION, +// '0', +// $scopeType, +// $scopeId +// ); + } + + return parent::beforeSave(); + } +} diff --git a/Model/Config/Source/MultiIndexer.php b/Model/Config/Source/MultiIndexer.php new file mode 100644 index 000000000..0ca15f0b2 --- /dev/null +++ b/Model/Config/Source/MultiIndexer.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright (c) 2020, Nosto Solutions Ltd + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @author Nosto Solutions Ltd <contact@nosto.com> + * @copyright 2020 Nosto Solutions Ltd + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause + * + */ + +namespace Nosto\Tagging\Model\Config\Source; + +use Magento\Framework\Data\OptionSourceInterface; +use Magento\Framework\Phrase; +use Nosto\Tagging\Helper\Data; + +/** + * Option array class to generate a list of selectable options that allows the merchant to choose + * any image attribute for his image tag. + */ +class MultiIndexer implements OptionSourceInterface +{ + /** + * Options getter + * + * @return array + */ + public function toOptionArray() + { + return [ + ['value' => Data::SETTING_VALUE_MI_PRODUCT_INDEXER, 'label' => new Phrase('Product Indexer')], + ['value' => Data::SETTING_VALUE_MI_PRODUCT_LIGHT_INDEXER, 'label' => new Phrase('Product light indexer')], + ['value' => Data::SETTING_VALUE_MI_PRODUCT_DISABLED, 'label' => new Phrase('Disabled')] + ]; + } +} diff --git a/Model/Config/Source/WebsitePublicity.php b/Model/Config/Source/WebsitePublicity.php new file mode 100644 index 000000000..c897c3228 --- /dev/null +++ b/Model/Config/Source/WebsitePublicity.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Nosto\Tagging\Model\Config\Source; + +/** + * @api + * @since 100.0.2 + */ +class WebsitePublicity implements \Magento\Framework\Option\ArrayInterface +{ + /** + * Options getter + * + * @return array + */ + public function toOptionArray() + { + return [['value' => 1, 'label' => __('Yes')], ['value' => 0, 'label' => __('No')]]; + } + + /** + * Get options in "key-value" format + * + * @return array + */ + public function toArray() + { + return [0 => __('No'), 1 => __('Yes')]; + } +} diff --git a/Model/Indexer/LightProductIndexer.php b/Model/Indexer/LightProductIndexer.php index c92ef4238..c96fe21ab 100644 --- a/Model/Indexer/LightProductIndexer.php +++ b/Model/Indexer/LightProductIndexer.php @@ -51,6 +51,7 @@ use Nosto\Tagging\Model\Service\Indexer\IndexerStatusServiceInterface; use Symfony\Component\Console\Input\InputInterface; use Nosto\Tagging\Model\Service\Sync\Recrawl\RecrawlService; +use Nosto\Tagging\Helper\Data as NostoHelperData; /** * Class ProductIndexer @@ -66,6 +67,9 @@ class LightProductIndexer extends AbstractIndexer /** @var ProductModeSwitcher */ private ProductModeSwitcher $modeSwitcher; + /** @var NostoHelperData */ + protected NostoHelperData $nostoHelperData; + /** @var RecrawlService */ private RecrawlService $recrawlService; @@ -81,6 +85,7 @@ class LightProductIndexer extends AbstractIndexer * @param InputInterface $input * @param IndexerStatusServiceInterface $indexerStatusService * @param RecrawlService $recrawlService + * @param NostoHelperData $nostoHelperData */ public function __construct( NostoHelperScope $nostoHelperScope, @@ -92,11 +97,13 @@ public function __construct( ProcessManager $processManager, InputInterface $input, IndexerStatusServiceInterface $indexerStatusService, - RecrawlService $recrawlService + RecrawlService $recrawlService, + NostoHelperData $nostoHelperData ) { $this->productCollectionBuilder = $productCollectionBuilder; $this->modeSwitcher = $modeSwitcher; $this->recrawlService = $recrawlService; + $this->nostoHelperData = $nostoHelperData; parent::__construct( $nostoHelperScope, $logger, @@ -123,10 +130,10 @@ public function getModeSwitcher(): ModeSwitcherInterface */ public function doIndex(Store $store, array $ids = []) { -// if ($this->nostoHelperData->getUseLightIndexer($store)) { + if ($this->nostoHelperData->isMultiIndexerLightIndexerEnabled($store)) { $collection = $this->getCollection($store, $ids); $this->recrawlService->recrawl($collection, $store); -// } + } } /** diff --git a/Model/Indexer/ProductIndexer.php b/Model/Indexer/ProductIndexer.php index c6dc1e725..71b6bd549 100644 --- a/Model/Indexer/ProductIndexer.php +++ b/Model/Indexer/ProductIndexer.php @@ -41,6 +41,7 @@ use Magento\Store\Model\App\Emulation; use Magento\Store\Model\Store; use Nosto\NostoException; +use Nosto\Tagging\Helper\Data as NostoHelperData; use Nosto\Tagging\Helper\Scope as NostoHelperScope; use Nosto\Tagging\Logger\Logger as NostoLogger; use Nosto\Tagging\Model\Indexer\Dimensions\Product\ModeSwitcher as ProductModeSwitcher; @@ -69,6 +70,9 @@ class ProductIndexer extends AbstractIndexer /** @var ProductModeSwitcher */ private ProductModeSwitcher $modeSwitcher; + /** @var NostoHelperData */ + protected NostoHelperData $nostoHelperData; + /** * Invalidate constructor. * @param NostoHelperScope $nostoHelperScope @@ -92,11 +96,13 @@ public function __construct( Emulation $storeEmulation, ProcessManager $processManager, InputInterface $input, - IndexerStatusServiceInterface $indexerStatusService + IndexerStatusServiceInterface $indexerStatusService, + NostoHelperData $nostoHelperData ) { $this->productUpdateService = $productUpdateService; $this->productCollectionBuilder = $productCollectionBuilder; $this->modeSwitcher = $modeSwitcher; + $this->nostoHelperData = $nostoHelperData; parent::__construct( $nostoHelperScope, $logger, @@ -123,11 +129,15 @@ public function getModeSwitcher(): ModeSwitcherInterface */ public function doIndex(Store $store, array $ids = []) { - $collection = $this->getCollection($store, $ids); - $this->productUpdateService->addCollectionToUpdateMessageQueue( - $collection, - $store - ); + if ($this->nostoHelperData->isMultiIndexerMainIndexerEnabled($store)) { + $collection = $this->getCollection($store, $ids); + $this->productUpdateService->addCollectionToUpdateMessageQueue( + $collection, + $store + ); + } else { + $this->nostoLogger->debugWithSource(); + } } /** diff --git a/Model/Service/AbstractService.php b/Model/Service/AbstractService.php index 6351e5b3a..d019fb124 100644 --- a/Model/Service/AbstractService.php +++ b/Model/Service/AbstractService.php @@ -49,7 +49,7 @@ abstract class AbstractService { /** @var NostoDataHelper */ - private NostoDataHelper $nostoDataHelper; + protected NostoDataHelper $nostoDataHelper; /** @var NostoLogger */ private NostoLogger $nostoLogger; diff --git a/Model/Service/Sync/Recrawl/RecrawlService.php b/Model/Service/Sync/Recrawl/RecrawlService.php index b30870fd6..7d4434a97 100644 --- a/Model/Service/Sync/Recrawl/RecrawlService.php +++ b/Model/Service/Sync/Recrawl/RecrawlService.php @@ -71,6 +71,9 @@ class RecrawlService extends AbstractService /** @var NostoHelperAccount */ private NostoHelperAccount $nostoHelperAccount; + /** @var NostoHelperData */ + protected NostoHelperData $nostoHelperData; + /** @var NostoHelperUrl */ private NostoHelperUrl $nostoHelperUrl; @@ -99,6 +102,7 @@ public function __construct( $this->cacheService = $cacheService; $this->productService = $productService; $this->nostoHelperAccount = $nostoHelperAccount; + $this->nostoHelperData = $nostoHelperData; $this->nostoHelperUrl = $nostoHelperUrl; $this->productRepository = $productRepository; parent::__construct($nostoHelperData, $nostoHelperAccount, $logger); @@ -115,13 +119,13 @@ public function __construct( */ public function recrawl(ProductCollection $collection, Store $store) { -// if (!$this->nostoDataHelper->isProductUpdatesEnabled($store)) { -// $this->logDebugWithStore( -// 'Nosto product sync is disabled - skipping products recrawl request to Nosto', -// $store -// ); -// return; -// } + if (!$this->nostoDataHelper->isProductUpdatesEnabled($store)) { + $this->logDebugWithStore( + 'Nosto product sync is disabled - skipping products recrawl request to Nosto', + $store + ); + return; + } $account = $this->nostoHelperAccount->findAccount($store); $this->startBenchmark(self::BENCHMARK_RECRAWL_NAME, self::BENCHMARK_RECRAWL_BREAKPOINT); diff --git a/Model/Service/Sync/Upsert/SyncService.php b/Model/Service/Sync/Upsert/SyncService.php index fda89b5ae..de40ae3e4 100644 --- a/Model/Service/Sync/Upsert/SyncService.php +++ b/Model/Service/Sync/Upsert/SyncService.php @@ -66,7 +66,7 @@ class SyncService extends AbstractService private NostoHelperUrl $nostoHelperUrl; /** @var NostoDataHelper */ - private NostoDataHelper $nostoDataHelper; + protected NostoDataHelper $nostoDataHelper; /** @var ProductServiceInterface */ private ProductServiceInterface $productService; diff --git a/composer.json b/composer.json index 86278a314..e0f1ab983 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "php": ">=7.4.0", "magento/framework": ">=101.0.6|~104.0", "ext-json": "*", - "nosto/php-sdk": "^7.4", + "nosto/php-sdk": "dev-add-recrawl-endpoint", "laminas/laminas-uri": "*" }, "repositories": [ diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 5515e3001..02c829f33 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -159,16 +159,6 @@ </comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="product_updates" translate="label comment" type="select" sortOrder="50" - showInDefault="1" showInWebsite="1" showInStore="1"> - <label>Product Updates via API</label> - <comment><![CDATA[Enable product updates via API for keeping the catalog in sync. - <strong style="color:red">Warning!</strong> Disabling this feature may - lead to products with incorrect pricing and availability data to be displayed - in recommendations.]]> - </comment> - <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> - </field> <field id="low_stock_indication" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Enable Low Stock Indication</label> @@ -191,22 +181,6 @@ </comment> <source_model>Nosto\Tagging\Model\Config\Source\Memory</source_model> </field> - <field id="product_per_request" translate="label comment" type="select" sortOrder="110" - showInDefault="1" showInWebsite="1" showInStore="1"> - <label>Light Recrawl Indexer - Products per Request</label> - <comment> - <![CDATA[Set the number of product IDs to be sent to Nosto in each request. A lower number can prevent overwhelming Nosto during updates.]]> - </comment> - <source_model>Nosto\Tagging\Model\Config\Source\ProductsPerRequest</source_model> - </field> - <field id="time_between_batch_of_requests" translate="label comment" type="select" sortOrder="110" - showInDefault="1" showInWebsite="1" showInStore="1"> - <label>Light Recrawl Indexer - Time between batch of requests (seconds)</label> - <comment> - <![CDATA[Define the time between batch of requests to Nosto. This helps manage traffic and prevents potential spikes that could affect performance.]]> - </comment> - <source_model>Nosto\Tagging\Model\Config\Source\TimeBetweenBatchOfRequests</source_model> - </field> <field id="indexer_disabled_products" translate="label comment" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Index disabled products</label> @@ -300,6 +274,63 @@ <frontend_model>Nosto\Tagging\Block\Adminhtml\Form\Field\Tokens</frontend_model> </field> </group> + <group id="product_sync" translate="label" type="text" sortOrder="10" showInDefault="1" + showInWebsite="1" showInStore="1"> + <label>Product Sync and Indexers</label> + <field id="indexer_method" translate="label comment" type="select" sortOrder="10" + showInDefault="1" showInWebsite="1" showInStore="1"> + <label>Multi indexer setup</label> + <comment>Set this to "Product indexer" if your store uses Magento's product regural indexer. If the store view uses light indexer set this to + "Product light indexer". If you disable indexer you set this to "Disabled" and Nosto will not try to do any indexer. + </comment> + <source_model>Nosto\Tagging\Model\Config\Source\MultiIndexer</source_model> + <backend_model>Nosto\Tagging\Model\Config\Backend\MultiIndexer</backend_model> + </field> + <field id="product_updates" translate="label comment" type="select" sortOrder="10" + showInDefault="1" showInWebsite="1" showInStore="1"> + <depends> + <field id="indexer_method">productindexer</field> + </depends> + <label>Product Updates via API</label> + <comment><![CDATA[Enable product updates via API for keeping the catalog in sync. + <strong style="color:red">Warning!</strong> Disabling this feature may + lead to products with incorrect pricing and availability data to be displayed + in recommendations.]]> + </comment> + <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + </field> + <field id="product_per_request" translate="label comment" type="select" sortOrder="50" + showInDefault="1" showInWebsite="1" showInStore="1"> + <depends> + <field id="indexer_method">productlightindexer</field> + </depends> + <label>Light Recrawl Indexer - Products per Request</label> + <comment> + <![CDATA[Set the number of product IDs to be sent to Nosto in each request. A lower number can prevent overwhelming Nosto during updates. + <strong style="color:red">Warning!</strong> The light recrawl indexer does not currently perform partial API updates with inventory levels. This feature is not yet implemented on Nosto's side.]]> + </comment> + <source_model>Nosto\Tagging\Model\Config\Source\ProductsPerRequest</source_model> + </field> + <field id="time_between_batch_of_requests" translate="label comment" type="select" sortOrder="60" + showInDefault="1" showInWebsite="1" showInStore="1"> + <depends> + <field id="indexer_method">productlightindexer</field> + </depends> + <label>Light Recrawl Indexer - Time between batch of requests (seconds)</label> + <comment> + <![CDATA[Define the time between batch of requests to Nosto. This helps manage traffic and prevents potential spikes that could affect performance. + <strong style="color:red">Warning!</strong> The light recrawl indexer does not currently perform partial API updates with inventory levels. This feature is not yet implemented on Nosto's side.]]> + </comment> + <source_model>Nosto\Tagging\Model\Config\Source\TimeBetweenBatchOfRequests</source_model> + </field> + <field id="website_publicity" translate="label comment" type="select" sortOrder="40" + showInDefault="1" showInWebsite="1" showInStore="1"> + <label>Website publicity</label> + <comment>Set this yes, because the light recrawl indexer only works if the website is publicity + </comment> + <source_model>Nosto\Tagging\Model\Config\Source\WebsitePublicity</source_model> + </field> + </group> </section> </system> </config> diff --git a/etc/config.xml b/etc/config.xml index 8e735381a..7dfb2fcbc 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -46,6 +46,13 @@ <url> <store_code_to_url>1</store_code_to_url> </url> + <product_sync> + <indexer_method>undefined</indexer_method> + <product_updates>1</product_updates> + <product_per_request>100</product_per_request> + <time_between_batch_of_requests>60</time_between_batch_of_requests> + <website_publicity>1</website_publicity> + </product_sync> <flags> <variation_tagging>1</variation_tagging> <use_custom_fields>1</use_custom_fields> @@ -56,8 +63,6 @@ <low_stock_indication>0</low_stock_indication> <send_customer_data>1</send_customer_data> <indexer_memory>50</indexer_memory> - <product_per_request>100</product_per_request> - <time_between_batch_of_requests>60</time_between_batch_of_requests> <indexer_disabled_products>0</indexer_disabled_products> <tag_date_published>0</tag_date_published> <track_multi_channel_orders>1</track_multi_channel_orders>