From e564b1dcd1c17f3bdfdc72845489c49e503306f3 Mon Sep 17 00:00:00 2001 From: Mohit Choudhary Date: Wed, 27 Jul 2022 17:39:40 +0530 Subject: [PATCH 01/18] Updated System Config comments --- etc/adminhtml/system.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 4bb49c51a..8549142a1 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -484,8 +484,8 @@ Magento\Config\Model\Config\Source\Yesno Enabling frequently bought together products can potentially break your design on PDP page and some work will be required to have a good integration with your theme. + Do you want the Frequently Bought Together products to display inside a product detail page after main product info? +
Enabling Frequently Bought Rogether products can potentially break your design on PDP page and some work will be required to have a good integration with your theme. ]]>
@@ -506,8 +506,8 @@ Magento\Config\Model\Config\Source\Yesno Enabling related products can potentially break your design on PDP page and some work will be required to have a good integration with your theme. + Do you want the Related Products to display inside a product detail page after main product info? +
Enabling Related Products can potentially break your design on PDP page and some work will be required to have a good integration with your theme. ]]>
@@ -517,7 +517,7 @@ From e786c8a489cce245ca2b20f6cb2a04096654ad44 Mon Sep 17 00:00:00 2001 From: Ratikant Singh Date: Thu, 28 Jul 2022 14:29:59 +0530 Subject: [PATCH 02/18] fix MAGE-314 --- view/frontend/web/internals/common.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/view/frontend/web/internals/common.js b/view/frontend/web/internals/common.js index 5c7659d68..48be7d4e0 100755 --- a/view/frontend/web/internals/common.js +++ b/view/frontend/web/internals/common.js @@ -677,10 +677,17 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { const queryString = qsModule.stringify(routeState); const portWithPrefix = port === '' ? '' : ':' + port; // IE <= 11 has no location.origin or buggy. Therefore we don't rely on it - if (!routeState || Object.keys(routeState).length === 0) + if (!routeState || Object.keys(routeState).length === 0) { return protocol + '//' + hostname + portWithPrefix + pathname; - else - return protocol + '//' + hostname + portWithPrefix + pathname + '?' + queryString; + } + else { + if (queryString) + { + return protocol + '//' + hostname + portWithPrefix + pathname + '?' + queryString; + } else { + return protocol + '//' + hostname + portWithPrefix + pathname; + } + } }, }), stateMapping: { From 40b199a47cfbf2c7bf691c82dde8d9f739848221 Mon Sep 17 00:00:00 2001 From: Ratikant Singh Date: Fri, 29 Jul 2022 10:57:54 +0530 Subject: [PATCH 03/18] MAGE-326 fix --- view/frontend/web/internals/common.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/view/frontend/web/internals/common.js b/view/frontend/web/internals/common.js index 5c7659d68..4ba95564a 100755 --- a/view/frontend/web/internals/common.js +++ b/view/frontend/web/internals/common.js @@ -229,8 +229,8 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { if (color.matchLevel === undefined || color.matchLevel === 'none') { return; } - - colors.push(color.value); + //colors.push(color.value); + colors.push(color); if (algoliaConfig.useAdaptiveImage === true) { var matchedColor = color.matchedWords.join(' '); @@ -240,9 +240,9 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { } }); - colors = colors.join(', '); - - hit._highlightResult.color = { value: colors }; + //colors = colors.join(', '); + //hit._highlightResult.color = { value: colors }; + hit._highlightResult.color = colors; } else { if (hit._highlightResult.color && hit._highlightResult.color.matchLevel === 'none') { From 7cf4ace34b6981d32b07058abcb3b951293da476 Mon Sep 17 00:00:00 2001 From: Ratikant Singh Date: Fri, 29 Jul 2022 14:23:32 +0530 Subject: [PATCH 04/18] fix mage 314 --- view/frontend/web/internals/common.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/view/frontend/web/internals/common.js b/view/frontend/web/internals/common.js index 48be7d4e0..21eb74571 100755 --- a/view/frontend/web/internals/common.js +++ b/view/frontend/web/internals/common.js @@ -681,8 +681,7 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { return protocol + '//' + hostname + portWithPrefix + pathname; } else { - if (queryString) - { + if (queryString) { return protocol + '//' + hostname + portWithPrefix + pathname + '?' + queryString; } else { return protocol + '//' + hostname + portWithPrefix + pathname; From e5e4e5f8d7b0329e2f063e61fd5ddf0baeed49db Mon Sep 17 00:00:00 2001 From: Ratikant Singh Date: Mon, 1 Aug 2022 17:02:07 +0530 Subject: [PATCH 05/18] MAGE-327 implementation --- Helper/Entity/ProductHelper.php | 8 ++++++-- Model/Source/Facets.php | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Helper/Entity/ProductHelper.php b/Helper/Entity/ProductHelper.php index 669985d55..b8049e081 100755 --- a/Helper/Entity/ProductHelper.php +++ b/Helper/Entity/ProductHelper.php @@ -1000,8 +1000,12 @@ private function getAttributesForFaceting($storeId) } } else { $attribute = $facet['attribute']; - if (array_key_exists('searchable', $facet) && $facet['searchable'] === '1') { - $attribute = 'searchable(' . $attribute . ')'; + if (array_key_exists('searchable', $facet)) { + if ($facet['searchable'] === '1') { + $attribute = 'searchable(' . $attribute . ')'; + } elseif ($facet['searchable'] === '3') { + $attribute = 'filterOnly(' . $attribute . ')'; + } } $attributesForFaceting[] = $attribute; diff --git a/Model/Source/Facets.php b/Model/Source/Facets.php index 391a845a7..2b43b75bb 100755 --- a/Model/Source/Facets.php +++ b/Model/Source/Facets.php @@ -36,8 +36,8 @@ protected function getTableData() 'label' => 'Label', ], 'searchable' => [ - 'label' => 'Searchable?', - 'values' => ['1' => 'Yes', '2' => 'No'], + 'label' => 'Options', + 'values' => ['1' => 'Searchable', '2' => 'Not Searchable', '3' => 'FilterOnly'], ], ]; From 9f2be3807d2b0b4fd8454ee92ee1be943cd6572b Mon Sep 17 00:00:00 2001 From: Ratikant Singh Date: Thu, 4 Aug 2022 13:45:24 +0530 Subject: [PATCH 06/18] MAGE-344 implementation --- Helper/Entity/ProductHelper.php | 2 +- Model/Source/SynonymsFile.php | 71 +++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/Helper/Entity/ProductHelper.php b/Helper/Entity/ProductHelper.php index 669985d55..14e1b1f88 100755 --- a/Helper/Entity/ProductHelper.php +++ b/Helper/Entity/ProductHelper.php @@ -391,7 +391,7 @@ public function setSettings($indexName, $indexNameTmp, $storeId, $saveToTmpIndic if ($this->configHelper->isEnabledSynonyms($storeId) === true) { if ($synonymsFile = $this->configHelper->getSynonymsFile($storeId)) { - $synonymsToSet = json_decode(file_get_contents($synonymsFile)); + $synonymsToSet = json_decode(file_get_contents($synonymsFile), true); } else { $synonymsToSet = []; diff --git a/Model/Source/SynonymsFile.php b/Model/Source/SynonymsFile.php index ce8343498..74988a45b 100755 --- a/Model/Source/SynonymsFile.php +++ b/Model/Source/SynonymsFile.php @@ -3,11 +3,82 @@ namespace Algolia\AlgoliaSearch\Model\Source; use Magento\Config\Model\Config\Backend\File; +use Magento\Framework\Filesystem; +use Magento\Framework\Serialize\JsonValidator; +use Magento\Framework\Filesystem\DriverInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use function PHPUnit\Framework\throwException; class SynonymsFile extends File { + /** + * @var JsonValidator + */ + protected $jsonValidator; + + /** + * @var DriverInterface + */ + protected $driver; + + /** + * @param \Magento\Framework\Model\Context $context + * @param \Magento\Framework\Registry $registry + * @param ScopeConfigInterface $config + * @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList + * @param \Magento\MediaStorage\Model\File\UploaderFactory $uploaderFactory + * @param File\RequestData\RequestDataInterface $requestData + * @param Filesystem $filesystem + * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource + * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection + * @param JsonValidator $jsonValidator + * @param DriverInterface $driver + * @param array $data + */ + public function __construct( + \Magento\Framework\Model\Context $context, + \Magento\Framework\Registry $registry, + ScopeConfigInterface $config, + \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, + \Magento\MediaStorage\Model\File\UploaderFactory $uploaderFactory, + File\RequestData\RequestDataInterface $requestData, + Filesystem $filesystem, + \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, + \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, + JsonValidator $jsonValidator, + DriverInterface $driver, + array $data = [] + ) { + parent::__construct($context, $registry, $config, $cacheTypeList, $uploaderFactory, $requestData, $filesystem, $resource, $resourceCollection, $data); + $this->jsonValidator = $jsonValidator; + $this->driver = $driver; + } + protected function _getAllowedExtensions() { return ['json']; } + + public function beforeSave() + { + $file = $this->getFileData(); + if (!empty($file)) { + $data = $this->driver->fileGetContents(($file['tmp_name'])); + if (!$this->jsonValidator->isValid($data)) { + throw new \Magento\Framework\Exception\LocalizedException( + __('Json file is not valid. Please check the file') + ); + } + + $convertJsontoArray = json_decode($data, true); + foreach ($convertJsontoArray as $jsonArray) { + if (!array_key_exists('objectID', $jsonArray)) { + throw new \Magento\Framework\Exception\LocalizedException( + __('objectID is missing from the json, please make sure objectId is unique and added for all the synonyms') + ); + } + } + } + return parent::beforeSave(); + } } From 0b898f690cac5f55c70dffb585db7790cd3aff20 Mon Sep 17 00:00:00 2001 From: Ratikant Singh Date: Thu, 4 Aug 2022 14:20:18 +0530 Subject: [PATCH 07/18] MAGE-344 --- Model/Source/SynonymsFile.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Model/Source/SynonymsFile.php b/Model/Source/SynonymsFile.php index 74988a45b..20827a816 100755 --- a/Model/Source/SynonymsFile.php +++ b/Model/Source/SynonymsFile.php @@ -5,9 +5,7 @@ use Magento\Config\Model\Config\Backend\File; use Magento\Framework\Filesystem; use Magento\Framework\Serialize\JsonValidator; -use Magento\Framework\Filesystem\DriverInterface; use Magento\Framework\App\Config\ScopeConfigInterface; -use function PHPUnit\Framework\throwException; class SynonymsFile extends File { @@ -16,11 +14,6 @@ class SynonymsFile extends File */ protected $jsonValidator; - /** - * @var DriverInterface - */ - protected $driver; - /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -32,7 +25,6 @@ class SynonymsFile extends File * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection * @param JsonValidator $jsonValidator - * @param DriverInterface $driver * @param array $data */ public function __construct( @@ -46,12 +38,10 @@ public function __construct( \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, JsonValidator $jsonValidator, - DriverInterface $driver, array $data = [] ) { parent::__construct($context, $registry, $config, $cacheTypeList, $uploaderFactory, $requestData, $filesystem, $resource, $resourceCollection, $data); $this->jsonValidator = $jsonValidator; - $this->driver = $driver; } protected function _getAllowedExtensions() @@ -63,7 +53,7 @@ public function beforeSave() { $file = $this->getFileData(); if (!empty($file)) { - $data = $this->driver->fileGetContents(($file['tmp_name'])); + $data = file_get_contents($file['tmp_name']); if (!$this->jsonValidator->isValid($data)) { throw new \Magento\Framework\Exception\LocalizedException( __('Json file is not valid. Please check the file') From 2e91f6ce72f5b2b3eaf4677d9b2c5155a7da8a69 Mon Sep 17 00:00:00 2001 From: rachel-trott Date: Tue, 9 Aug 2022 12:04:57 -0500 Subject: [PATCH 08/18] MAGE-359 - whitelist insights.algolia.io in csp --- etc/csp_whitelist.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/csp_whitelist.xml b/etc/csp_whitelist.xml index d72b51192..c533d4a43 100644 --- a/etc/csp_whitelist.xml +++ b/etc/csp_whitelist.xml @@ -12,7 +12,8 @@ *.algolia.net *.algolia.com *.algolianet.com + *.insights.algolia.io - \ No newline at end of file + From b5da833304c93a1fcc5bf412a91a7a0cf14b6f38 Mon Sep 17 00:00:00 2001 From: rachel-trott Date: Tue, 16 Aug 2022 12:08:56 -0500 Subject: [PATCH 09/18] MAGE-375 - Fix issue with table prefix and code cleanup --- Setup/Patch/Data/UpdateMviewPatch.php | 11 ++++-- Setup/Patch/Schema/ConfigPatch.php | 57 +++++++++++++++++---------- Setup/Uninstall.php | 3 +- 3 files changed, 45 insertions(+), 26 deletions(-) diff --git a/Setup/Patch/Data/UpdateMviewPatch.php b/Setup/Patch/Data/UpdateMviewPatch.php index 028ad265d..f206223d3 100644 --- a/Setup/Patch/Data/UpdateMviewPatch.php +++ b/Setup/Patch/Data/UpdateMviewPatch.php @@ -12,17 +12,17 @@ class UpdateMviewPatch implements DataPatchInterface /** * @var SubscriptionFactory */ - private $subscriptionFactory; + protected $subscriptionFactory; /** * @var IndexerInterfaceFactory */ - private $indexerFactory; + protected $indexerFactory; /** * @var ModuleDataSetupInterface */ - private $moduleDataSetup; + protected $moduleDataSetup; /** * @param SubscriptionFactory $subscriptionFactory @@ -39,6 +39,9 @@ public function __construct( $this->indexerFactory = $indexerFactory; } + /** + * @return UpdateMviewPatch|void + */ public function apply() { $this->moduleDataSetup->getConnection()->startSetup(); @@ -49,7 +52,7 @@ public function apply() $subscriptionInstance = $this->subscriptionFactory->create( [ 'view' => $indexer->getView(), - 'tableName' => 'catalog_product_index_price', + 'tableName' => $this->moduleDataSetup->getTable('catalog_product_index_price'), 'columnName' => 'entity_id', ] ); diff --git a/Setup/Patch/Schema/ConfigPatch.php b/Setup/Patch/Schema/ConfigPatch.php index f11ff2645..b2c66856a 100644 --- a/Setup/Patch/Schema/ConfigPatch.php +++ b/Setup/Patch/Schema/ConfigPatch.php @@ -14,24 +14,22 @@ class ConfigPatch implements SchemaPatchInterface /** * @var ConfigInterface */ - private $config; + protected $config; /** * @var ProductMetadataInterface */ - private $productMetadata; + protected $productMetadata; /** * @var ModuleDataSetupInterface */ - private $moduleDataSetup; + protected $moduleDataSetup; /** - * @var SubscriptionFactory + * @var string[] */ - private $subscriptionFactory; - - private $defaultConfigData = [ + protected $defaultConfigData = [ 'algoliasearch_credentials/credentials/enable_backend' => '1', 'algoliasearch_credentials/credentials/enable_frontend' => '1', 'algoliasearch_credentials/credentials/application_id' => '', @@ -97,7 +95,10 @@ class ConfigPatch implements SchemaPatchInterface 'algoliasearch_advanced/advanced/archive_clear_limit' => '30', ]; - private $defaultArrayConfigData = [ + /** + * @var string[][][] + */ + protected $defaultArrayConfigData = [ 'algoliasearch_autocomplete/autocomplete/sections' => [ [ 'name' => 'pages', @@ -257,35 +258,43 @@ class ConfigPatch implements SchemaPatchInterface ], ]; - private $indexerFactory; - + /** + * @param ConfigInterface $config + * @param ProductMetadataInterface $productMetadata + * @param ModuleDataSetupInterface $moduleDataSetup Magento\Framework\App\ResourceConnection + */ public function __construct( ConfigInterface $config, ProductMetadataInterface $productMetadata, - ModuleDataSetupInterface $moduleDataSetup, - SubscriptionFactory $subscriptionFactory, - IndexerInterfaceFactory $indexerFactory + ModuleDataSetupInterface $moduleDataSetup ) { $this->config = $config; $this->productMetadata = $productMetadata; $this->moduleDataSetup = $moduleDataSetup; - $this->subscriptionFactory = $subscriptionFactory; $this->serializeDefaultArrayConfigData(); $this->mergeDefaultDataWithArrayData(); - $this->indexerFactory = $indexerFactory; } + /** + * @return array|string[] + */ public static function getDependencies() { return []; } + /** + * @return array|string[] + */ public function getAliases() { return []; } + /** + * @return ConfigPatch|void + */ public function apply() { $movedConfigDirectives = [ @@ -298,17 +307,16 @@ public function apply() $this->moduleDataSetup->getConnection()->startSetup(); $connection = $this->moduleDataSetup->getConnection(); - $table = $connection->getTableName('core_config_data'); + $table = $this->moduleDataSetup->getTable('core_config_data'); foreach ($movedConfigDirectives as $from => $to) { try { $connection->query('UPDATE ' . $table . ' SET path = "' . $to . '" WHERE path = "' . $from . '"'); } catch (\Magento\Framework\DB\Adapter\DuplicateException $e) { - // + // Skip } } /* SET DEFAULT CONFIG DATA */ - $alreadyInserted = $connection->getConnection() ->query('SELECT path, value FROM ' . $table . ' WHERE path LIKE "algoliasearch_%"') ->fetchAll(\PDO::FETCH_KEY_PAIR); @@ -323,12 +331,18 @@ public function apply() $this->moduleDataSetup->getConnection()->endSetup(); } + /** + * @return string[] + */ public function getDefaultConfigData() { return $this->defaultConfigData; } - private function serializeDefaultArrayConfigData() + /** + * @return void + */ + protected function serializeDefaultArrayConfigData() { $serializeMethod = 'serialize'; @@ -342,7 +356,10 @@ private function serializeDefaultArrayConfigData() } } - private function mergeDefaultDataWithArrayData() + /** + * @return void + */ + protected function mergeDefaultDataWithArrayData() { $this->defaultConfigData = array_merge($this->defaultConfigData, $this->defaultArrayConfigData); } diff --git a/Setup/Uninstall.php b/Setup/Uninstall.php index e8067a23f..96d214f26 100644 --- a/Setup/Uninstall.php +++ b/Setup/Uninstall.php @@ -2,7 +2,6 @@ namespace Algolia\AlgoliaSearch\Setup; -use Algolia\AlgoliaSearch\Api\Data\LandingPageInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; use Magento\Framework\Setup\UninstallInterface; @@ -18,7 +17,7 @@ public function uninstall(SchemaSetupInterface $setup, ModuleContextInterface $c $connection->dropTable($setup->getTable('algoliasearch_queue')); $connection->dropTable($setup->getTable('algoliasearch_queue_log')); $connection->dropTable($setup->getTable('algoliasearch_queue_archive')); - $connection->dropTable($setup->getTable(LandingPageInterface::TABLE_NAME)); + $connection->dropTable($setup->getTable('algoliasearch_landing_page')); $setup->endSetup(); } From 25f3d13ec219aff05c23f542dc0ce97ccef52a8e Mon Sep 17 00:00:00 2001 From: rachel-trott Date: Thu, 18 Aug 2022 15:50:46 -0500 Subject: [PATCH 10/18] MAGE-326 - Remove comments (restoring lost coomit) --- view/frontend/web/internals/common.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/view/frontend/web/internals/common.js b/view/frontend/web/internals/common.js index 4ba95564a..33df585cb 100755 --- a/view/frontend/web/internals/common.js +++ b/view/frontend/web/internals/common.js @@ -229,7 +229,6 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { if (color.matchLevel === undefined || color.matchLevel === 'none') { return; } - //colors.push(color.value); colors.push(color); if (algoliaConfig.useAdaptiveImage === true) { @@ -240,8 +239,6 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { } }); - //colors = colors.join(', '); - //hit._highlightResult.color = { value: colors }; hit._highlightResult.color = colors; } else { From d558acc3f41367dfee9dba5ce8c85ff53ad5e657 Mon Sep 17 00:00:00 2001 From: Mohit Choudhary Date: Thu, 25 Aug 2022 17:48:46 +0530 Subject: [PATCH 11/18] fixed type --- etc/adminhtml/system.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 8549142a1..a1a37831f 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -485,7 +485,7 @@ Enabling Frequently Bought Rogether products can potentially break your design on PDP page and some work will be required to have a good integration with your theme. +
Enabling Frequently Bought Together products can potentially break your design on PDP page and some work will be required to have a good integration with your theme. ]]>
From 8110ead64200f78569dec733deaba361810c1c8f Mon Sep 17 00:00:00 2001 From: Ratikant Singh Date: Fri, 26 Aug 2022 11:38:24 +0530 Subject: [PATCH 12/18] Added Space between Filter Only --- Model/Source/Facets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Source/Facets.php b/Model/Source/Facets.php index 2b43b75bb..8a72e1d3e 100755 --- a/Model/Source/Facets.php +++ b/Model/Source/Facets.php @@ -37,7 +37,7 @@ protected function getTableData() ], 'searchable' => [ 'label' => 'Options', - 'values' => ['1' => 'Searchable', '2' => 'Not Searchable', '3' => 'FilterOnly'], + 'values' => ['1' => 'Searchable', '2' => 'Not Searchable', '3' => 'Filter Only'], ], ]; From 0c5fcabf0dd69d0e6409170e371ee984c3945b1e Mon Sep 17 00:00:00 2001 From: Ratikant Singh Date: Mon, 29 Aug 2022 15:55:46 +0530 Subject: [PATCH 13/18] Fix Magento 2.4.5 compatibility issue --- .../Indexer => Plugin}/StockItemObserver.php | 33 ++++++++++++++----- etc/di.xml | 2 +- 2 files changed, 25 insertions(+), 10 deletions(-) rename {Model/Indexer => Plugin}/StockItemObserver.php (56%) diff --git a/Model/Indexer/StockItemObserver.php b/Plugin/StockItemObserver.php similarity index 56% rename from Model/Indexer/StockItemObserver.php rename to Plugin/StockItemObserver.php index 2833c4e4d..94bc5fefb 100644 --- a/Model/Indexer/StockItemObserver.php +++ b/Plugin/StockItemObserver.php @@ -1,35 +1,50 @@ indexer = $indexerRegistry->get('algolia_products'); } - public function afterSave( + /** + * @param \Magento\CatalogInventory\Model\ResourceModel\Stock\Item $stockItemModel + * @param StockItem $stockItem + * @return void + */ + public function beforeSave( \Magento\CatalogInventory\Model\ResourceModel\Stock\Item $stockItemModel, - \Magento\CatalogInventory\Model\ResourceModel\Stock\Item $result, - \Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem + StockItem $stockItem ) { $stockItemModel->addCommitCallback(function () use ($stockItem) { if (!$this->indexer->isScheduled()) { $this->indexer->reindexRow($stockItem->getProductId()); } }); - - return $result; } + /** + * @param \Magento\CatalogInventory\Model\ResourceModel\Stock\Item $stockItemResource + * @param \Magento\CatalogInventory\Model\ResourceModel\Stock\Item|null $result + * @param \Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem + * @return \Magento\CatalogInventory\Model\ResourceModel\Stock\Item|null + */ public function afterDelete( \Magento\CatalogInventory\Model\ResourceModel\Stock\Item $stockItemResource, - \Magento\CatalogInventory\Model\ResourceModel\Stock\Item $result, + \Magento\CatalogInventory\Model\ResourceModel\Stock\Item $result = null, \Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem ) { $stockItemResource->addCommitCallback(function () use ($stockItem) { diff --git a/etc/di.xml b/etc/di.xml index f4c9ceda4..0427237a4 100755 --- a/etc/di.xml +++ b/etc/di.xml @@ -7,7 +7,7 @@ - + From 21e6d25ae199392f139b1962b0dc3dbd06c0bafb Mon Sep 17 00:00:00 2001 From: rachel-trott Date: Tue, 30 Aug 2022 21:10:37 -0500 Subject: [PATCH 14/18] Add comment to show Click Analytics is free --- etc/adminhtml/system.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 4bb49c51a..697cd2939 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -710,7 +710,7 @@ Magento\Config\Model\Config\Source\Yesno From 08ba18695ab67e99134258b6f41c0ee5967515ae Mon Sep 17 00:00:00 2001 From: Ratikant Singh Date: Fri, 2 Sep 2022 01:40:34 +0530 Subject: [PATCH 15/18] Duplicate entry in queue --- etc/di.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/di.xml b/etc/di.xml index 0427237a4..e14a17af1 100755 --- a/etc/di.xml +++ b/etc/di.xml @@ -7,7 +7,7 @@ - + From 284e3360b288cfacd951d5029b833fd15f67d1d1 Mon Sep 17 00:00:00 2001 From: Mohit Choudhary Date: Fri, 2 Sep 2022 14:00:13 +0530 Subject: [PATCH 16/18] Updated Readme and changelog for release 3.8.1 --- CHANGELOG.md | 14 ++++++++++++++ README.md | 4 ++-- composer.json | 2 +- etc/module.xml | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f812e7e3..889a899fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # CHANGE LOG +## 3.8.1 + +### UPDATES +- Updated Click & Conversion Analytic System Configuration message +- Added a Validated when upload my synonyms in the Magento admin(#1226) +- Updated code to Set facets Filter Only via the instantsearch/facets settings in magento admin panel(#1224) +- Updated CSR policy to fix content security error for insights.io(#1228) + +### FIXES +- Fixed the InstantSearch variant image issue(#1223) +- Fixed the Proper Case 'Related Products' in comment Magento Admin (#1221) +- Fixed the code deploy error if db have tables with Prefix - patch not applied(#1229) +- Fixed the Remove trailing ? url in category page(#1222) + ## 3.8.0 ### New Features diff --git a/README.md b/README.md index 3d5e90eb4..5b68fd158 100755 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ Algolia Search for Magento 2 ================== -![Latest version](https://img.shields.io/badge/latest-3.8.0-green) +![Latest version](https://img.shields.io/badge/latest-3.8.1-green) ![Magento 2](https://img.shields.io/badge/Magento-2.4.x-orange) -![PHP](https://img.shields.io/badge/PHP-7.4%2C8.1-blue) +![PHP](https://img.shields.io/badge/PHP-8.1-blue) [![CircleCI](https://circleci.com/gh/algolia/algoliasearch-magento-2/tree/master.svg?style=svg)](https://circleci.com/gh/algolia/algoliasearch-magento-2/tree/master) diff --git a/composer.json b/composer.json index 46a4c35d2..ab0888f17 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Algolia Search integration for Magento 2", "type": "magento2-module", "license": ["MIT"], - "version": "3.8.0", + "version": "3.8.1", "require": { "magento/framework": "~102.0|~103.0", "algolia/algoliasearch-client-php": "^3.2", diff --git a/etc/module.xml b/etc/module.xml index de785d18b..defdf19a7 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - + From 31c97f7912054bcd2e498b64c6d4e22e710da043 Mon Sep 17 00:00:00 2001 From: Ratikant Singh Date: Fri, 2 Sep 2022 16:15:36 +0530 Subject: [PATCH 17/18] hotfix for color varient issue --- view/frontend/web/internals/common.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/view/frontend/web/internals/common.js b/view/frontend/web/internals/common.js index 4ba95564a..f95691a12 100755 --- a/view/frontend/web/internals/common.js +++ b/view/frontend/web/internals/common.js @@ -102,7 +102,7 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { return; } - colors.push(color.value); + colors.push(color); if (algoliaConfig.useAdaptiveImage === true) { var matchedColor = color.matchedWords.join(' '); @@ -112,9 +112,7 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { } }); - colors = colors.join(', '); - - hit._highlightResult.color = { value: colors }; + hit._highlightResult.color = colors; } else { if (hit._highlightResult.color && hit._highlightResult.color.matchLevel === 'none') { @@ -229,8 +227,8 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { if (color.matchLevel === undefined || color.matchLevel === 'none') { return; } - //colors.push(color.value); - colors.push(color); + + colors.push(color.value); if (algoliaConfig.useAdaptiveImage === true) { var matchedColor = color.matchedWords.join(' '); @@ -240,9 +238,8 @@ requirejs(['algoliaBundle'], function(algoliaBundle) { } }); - //colors = colors.join(', '); - //hit._highlightResult.color = { value: colors }; - hit._highlightResult.color = colors; + colors = colors.join(', '); + hit._highlightResult.color = { value: colors }; } else { if (hit._highlightResult.color && hit._highlightResult.color.matchLevel === 'none') { From 43d7e2f374157d4f51fd9350ad2e17c67e495bc5 Mon Sep 17 00:00:00 2001 From: Mohit Choudhary Date: Fri, 2 Sep 2022 17:35:34 +0530 Subject: [PATCH 18/18] Updated Readme and changelog for release 3.8.1 --- CHANGELOG.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 889a899fa..96212af2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,15 +3,15 @@ ## 3.8.1 ### UPDATES -- Updated Click & Conversion Analytic System Configuration message -- Added a Validated when upload my synonyms in the Magento admin(#1226) -- Updated code to Set facets Filter Only via the instantsearch/facets settings in magento admin panel(#1224) +- Updated the system configuration message for Click & Conversion Analytics +- Added validation in synonyms upload section (for Algolia Search) in the Magento admin(#1226) +- Updated code to set "Filter Only" facets via the instantsearch/facets settings in the Magento admin panel(#1224) - Updated CSR policy to fix content security error for insights.io(#1228) ### FIXES - Fixed the InstantSearch variant image issue(#1223) -- Fixed the Proper Case 'Related Products' in comment Magento Admin (#1221) -- Fixed the code deploy error if db have tables with Prefix - patch not applied(#1229) +- Fixed the proper case for 'Related Products' in comment Magento Admin (#1221) +- Fixed the code deploy error if the DB has tables with Prefix - patch not applied(#1229) - Fixed the Remove trailing ? url in category page(#1222) ## 3.8.0