Skip to content

Commit 3cbe7e5

Browse files
authored
Merge branch 'develop' into bugfix/MAGE-800
2 parents a188718 + 0247b4c commit 3cbe7e5

File tree

9 files changed

+50
-46
lines changed

9 files changed

+50
-46
lines changed

CHANGELOG.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
# CHANGE LOG
22

3-
## 3.11.0
3+
## 3.12.0
44

55
### Updates
6-
- Fixes related to NeuralSearch compatibility
7-
- Removed the redundant jquery library from AlgoliaBundle.
6+
- Updated code to consider user’s cookie consent to send events to Algolia by using ‘useCookie’ parameter
7+
- Updated references to [email protected] to new ticket link
8+
- Updated code to refactor the deprecated registry for categories
9+
- Updated code to ensure compatibility with NeuralSearch
10+
- Updated AlgoliaBundle by eliminating the unnecessary jQuery library
11+
- Included the promotion class in autocomplete menu when a product has any promotions
12+
13+
### Bug Fixes
14+
- Fixed formatting issue in product object related to CategoryPageId attribute
15+
- Fixed issue with Clear Refinements button in InstantSearch page
16+
- Fixed issue with custom banner functionality via merchandising dashboard in admin
17+
- Fixed issue with hierarchicalMenu widget when utilizing transformItems when the number of categories exceeded the limit
18+
- Fixed issue with indexing text field attributes with a value of 0
19+
- Fixed issue with user cookies not clearing upon customer logout
20+
- Fixed back button issue with pagination in instant search page and category pages
821

922
## 3.11.0
1023

Helper/Entity/ProductHelper.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ public function setSettings($indexName, $indexNameTmp, $storeId, $saveToTmpIndic
463463

464464
// Managing Virtual Replica
465465
if ($this->configHelper->useVirtualReplica($storeId)) {
466-
$replicas = $this->handleVirtualReplica($replicas);
466+
$replicas = $this->handleVirtualReplica($replicas, $indexName);
467467
}
468468

469469
// Merge current replicas with sorting replicas to not delete A/B testing replica indices
@@ -1534,7 +1534,7 @@ public function productIsInStock($product, $storeId)
15341534
* @param $replica
15351535
* @return array
15361536
*/
1537-
public function handleVirtualReplica($replicas)
1537+
public function handleVirtualReplica($replicas, $indexName)
15381538
{
15391539
$virtualReplicaArray = [];
15401540
foreach ($replicas as $replica) {
@@ -1558,14 +1558,12 @@ public function handlingReplica($indexName, $storeId, $sortingAttribute = false)
15581558
return $sortingIndex['name'];
15591559
}, $sortingIndices));
15601560
try {
1561-
$replicasFormated = $this->handleVirtualReplica($replicas);
1562-
$availableReplicaMatch = array_merge($replicasFormated, $replicas);
15631561
if ($this->configHelper->useVirtualReplica($storeId)) {
1564-
$replicas = $replicasFormated;
1562+
$replicas = $this->handleVirtualReplica($replicas, $indexName);
15651563
}
15661564
$currentSettings = $this->algoliaHelper->getSettings($indexName);
15671565
if (is_array($currentSettings) && array_key_exists('replicas', $currentSettings)) {
1568-
$replicasRequired = array_values(array_diff($currentSettings['replicas'], $availableReplicaMatch));
1566+
$replicasRequired = array_values(array_diff_assoc($currentSettings['replicas'], $replicas));
15691567
$this->algoliaHelper->setSettings($indexName, ['replicas' => $replicasRequired]);
15701568
$setReplicasTaskId = $this->algoliaHelper->getLastTaskId();
15711569
$this->algoliaHelper->waitLastTask($indexName, $setReplicasTaskId);

Helper/InsightsHelper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class InsightsHelper
2323
/** @var PersonalizationHelper */
2424
private $personalizationHelper;
2525

26+
/** @var SessionManagerInterface */
27+
private $sessionManager;
28+
2629
/** @var CookieManagerInterface */
2730
private $cookieManager;
2831

Model/Backend/Sorts.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,10 @@ public function afterSave()
7474
if ($this->isValueChanged()) {
7575
try{
7676
$oldValue = $this->serializer->unserialize($this->getOldValue());
77-
$updatedValue = $this->serializer->unserialize($this->getValue());
78-
$sortingAttributes = array_merge($oldValue, $updatedValue);
7977
$storeIds = array_keys($this->storeManager->getStores());
8078
foreach ($storeIds as $storeId) {
8179
$indexName = $this->helper->getIndexName($this->productHelper->getIndexNameSuffix(), $storeId);
82-
$this->productHelper->handlingReplica($indexName, $storeId, $sortingAttributes);
80+
$this->productHelper->handlingReplica($indexName, $storeId, $oldValue);
8381
}
8482
} catch (AlgoliaException $e) {
8583
if ($e->getCode() !== 404) {

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Algolia Search for Magento 2
2-
============================
1+
Algolia Search & Discovery extension for Magento 2
2+
==================================================
33

4-
![Latest version](https://img.shields.io/badge/latest-3.11.1%20beta-green)
4+
![Latest version](https://img.shields.io/badge/latest-3.12.0-green)
55
![Magento 2](https://img.shields.io/badge/Magento-2.4.x-orange)
66

77
![PHP](https://img.shields.io/badge/PHP-8.2%2C8.1%2C7.4-blue)
@@ -12,7 +12,7 @@ Algolia Search for Magento 2
1212

1313
## Features
1414

15-
The Algolia extension replaces the default search in Magento Open Source and Adobe Commerce with a robust autocomplete search menu and instant search results page.
15+
The Algolia extension replaces the default search in Magento Open Source and Adobe Commerce with a robust autocomplete search menu and Instantsearch results page.
1616

1717
This extension replaces the default search of Magento with a typo-tolerant, fast & relevant search experience backed by Algolia. It's based on [algoliasearch-client-php](https://github.com/algolia/algoliasearch-client-php), [autocomplete.js](https://github.com/algolia/autocomplete.js) and [instantsearch.js](https://github.com/algolia/instantsearch.js).
1818

@@ -61,7 +61,7 @@ With the release of a new major version, we have decided to create minor and maj
6161

6262
If you would like to stay on a minor version, please upgrade your composer to only accept versions less than version 2 like the example:
6363

64-
`"algolia/algoliasearch-magento-2": "3.10.2"`
64+
`"algolia/algoliasearch-magento-2": "3.12.0"`
6565

6666
### Customisation
6767

@@ -81,7 +81,7 @@ Knowing the version of the library will help you understand what is available in
8181
| v3.x | [0.38.0](https://github.com/algolia/autocomplete.js/tree/v0.38.0) | [4.15.0](https://github.com/algolia/instantsearch.js/tree/v4.15.0) | [1.7.1](https://github.com/algolia/search-insights.js/tree/v1.7.1) | NA |
8282
| v3.9.1 | [1.6.3](https://github.com/algolia/autocomplete.js/tree/v1.6.3) | [4.41.0](https://github.com/algolia/instantsearch.js/tree/v4.41.0) | [1.7.1](https://github.com/algolia/search-insights.js/tree/v1.7.1) | [1.5.0](https://github.com/algolia/recommend/tree/v1.5.0) |
8383
| v3.10.x | [1.6.3](https://github.com/algolia/autocomplete.js/tree/v1.6.3) | [4.41.0](https://github.com/algolia/instantsearch.js/tree/v4.41.0) | [1.7.1](https://github.com/algolia/search-insights.js/tree/v1.7.1) | [1.8.0](https://github.com/algolia/recommend/tree/v1.8.0) |
84-
| v3.11.0-beta | [1.6.3](https://github.com/algolia/autocomplete.js/tree/v1.6.3) | [4.41.0](https://github.com/algolia/instantsearch.js/tree/v4.41.0) | [2.6.0](https://github.com/algolia/search-insights.js/tree/v2.6.0) | [1.8.0](https://github.com/algolia/recommend/tree/v1.8.0) |
84+
| >=v3.11.0 | [1.6.3](https://github.com/algolia/autocomplete.js/tree/v1.6.3) | [4.41.0](https://github.com/algolia/instantsearch.js/tree/v4.41.0) | [2.6.0](https://github.com/algolia/search-insights.js/tree/v2.6.0) | [1.8.0](https://github.com/algolia/recommend/tree/v1.8.0) |
8585

8686
The autocomplete and instantsearch libraries are accessible in the `algoliaBundle` global. This bundle is a prepackage javascript file that contains it's dependencies. What is included in this bundle can be seen here:
8787

@@ -106,7 +106,8 @@ Depending on the extension version you are using, you could have a different PHP
106106
| v1.x | [1.28.0](https://github.com/algolia/algoliasearch-client-php/tree/1.28.0) |
107107
| v2.x | [2.5.1](https://github.com/algolia/algoliasearch-client-php/tree/2.5.1) |
108108
| v3.x | [2.5.1](https://github.com/algolia/algoliasearch-client-php/tree/2.5.1) |
109-
| >= v3.6.x | [3.2.0](https://github.com/algolia/algoliasearch-client-php/tree/3.2.0) |
109+
| v3.6.x | [3.2.0](https://github.com/algolia/algoliasearch-client-php/tree/3.2.0) |
110+
| >= v3.11.0 | [3.3.2](https://github.com/algolia/algoliasearch-client-php/tree/3.3.2) |
110111

111112
Refer to these docs when customising your Algolia Magento extension backend:
112113
- [Indexing](https://www.algolia.com/doc/integration/magento-2/how-it-works/indexing/)

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "algolia/algoliasearch-magento-2",
3-
"description": "Algolia Search integration for Magento 2",
3+
"description": "Algolia Search & Discovery extension for Magento 2",
44
"type": "magento2-module",
55
"license": ["MIT"],
6-
"version": "3.11.1-beta",
6+
"version": "3.12.0",
77
"require": {
88
"magento/framework": "~102.0|~103.0",
99
"algolia/algoliasearch-client-php": "3.3.2",

etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
3-
<module name="Algolia_AlgoliaSearch" setup_version="3.11.1">
3+
<module name="Algolia_AlgoliaSearch" setup_version="3.12.0">
44
<sequence>
55
<module name="Magento_Theme"/>
66
<module name="Magento_Backend"/>

view/frontend/web/insights/notices-mixin.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

view/frontend/web/instantsearch.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,21 @@ define(
660660
}
661661
});
662662

663-
var isStarted = false;
663+
// Capture active redirect URL with IS facet params for add to cart from PLP
664+
if (algoliaConfig.instant.isAddToCartEnabled) {
665+
search.on('render', () => {
666+
const cartForms = document.querySelectorAll('[data-role="tocart-form"]');
667+
cartForms.forEach((form, i) => {
668+
const ts = Date.now();
669+
form.addEventListener('submit', e => {
670+
const url = `${algoliaConfig.request.url}${window.location.search}`;
671+
e.target.elements[algoliaConfig.instant.addToCartParams.redirectUrlParam].value = AlgoliaBase64.mageEncode(url);
672+
})
673+
});
674+
});
675+
}
676+
677+
var isStarted = false;
664678

665679
function startInstantSearch() {
666680
if (isStarted === true) {

0 commit comments

Comments
 (0)