Skip to content

Commit

Permalink
Merge pull request #1211 from algolia/develop
Browse files Browse the repository at this point in the history
Merge to master from develop for release v3.7.0
  • Loading branch information
rakesh-algolia authored Jun 29, 2022
2 parents fba4b78 + f997694 commit d333c95
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 41 deletions.
4 changes: 3 additions & 1 deletion Block/Adminhtml/Category/Merchandising.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ public function isRootCategory()

if ($category) {
$path = $category->getPath();

if (!$path) {
return false;
}
$parts = explode('/', $path);
if (count($parts) <= 2) {
return true;
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGE LOG

## 3.7.0

### UPDATES
- Updated instantsearch.js(#1203)

### FIXES
- Fixed the autocomplete.js vulnerability issues (#1205)
- Fixed the issue with PHP 8.1: Deprecated Functionality: explode() on category page (#1208)
- Fixed the issue with Mview update by patch (#1210)

## 3.6.1

### UPDATES
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Algolia Search for Magento 2
==================

![Latest version](https://img.shields.io/badge/latest-3.6.1-green)
![Latest version](https://img.shields.io/badge/latest-3.7.0-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)
Expand Down Expand Up @@ -92,6 +92,7 @@ Knowing the version of the library will help you understand what is available in
| v1.x | [0.26.0](https://github.com/algolia/autocomplete.js/tree/v0.26.0) | [2.10.2](https://github.com/algolia/instantsearch.js/tree/v2.10.2) | [0.0.14](https://cdn.jsdelivr.net/npm/[email protected]) |
| v2.x | [0.38.0](https://github.com/algolia/autocomplete.js/tree/v0.38.0) | [4.7.2](https://github.com/algolia/instantsearch.js/tree/v4.7.2) | [1.4.0](https://github.com/algolia/search-insights.js/tree/v1.4.0) |
| 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) |
| v3.7.x | [0.38.0](https://github.com/algolia/autocomplete.js/tree/v0.38.0) | [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) |

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:

Expand Down
78 changes: 78 additions & 0 deletions Setup/Patch/Data/UpdateMviewPatch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

namespace Algolia\AlgoliaSearch\Setup\Patch\Data;

use Magento\Framework\Indexer\IndexerInterfaceFactory;
use Magento\Framework\Mview\View\SubscriptionFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

class UpdateMviewPatch implements DataPatchInterface
{
/**
* @var SubscriptionFactory
*/
private $subscriptionFactory;

/**
* @var IndexerInterfaceFactory
*/
private $indexerFactory;

/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* @param SubscriptionFactory $subscriptionFactory
* @param ModuleDataSetupInterface $moduleDataSetup
* @param IndexerInterfaceFactory $indexerFactory
*/
public function __construct(
SubscriptionFactory $subscriptionFactory,
ModuleDataSetupInterface $moduleDataSetup,
IndexerInterfaceFactory $indexerFactory
) {
$this->subscriptionFactory = $subscriptionFactory;
$this->moduleDataSetup = $moduleDataSetup;
$this->indexerFactory = $indexerFactory;
}

public function apply()
{
$this->moduleDataSetup->getConnection()->startSetup();

try {
/** @var \Magento\Framework\Indexer\IndexerInterface $indexer */
$indexer = $this->indexerFactory->create()->load('algolia_products');
$subscriptionInstance = $this->subscriptionFactory->create(
[
'view' => $indexer->getView(),
'tableName' => 'catalog_product_index_price',
'columnName' => 'entity_id',
]
);
$subscriptionInstance->remove();
} catch (\Exception $e) {
// Skip
}
$this->moduleDataSetup->getConnection()->endSetup();
}

/**
* @inheritdoc
*/
public static function getDependencies()
{
return [];
}

/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}
}
11 changes: 0 additions & 11 deletions Setup/Patch/Schema/ConfigPatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,17 +320,6 @@ public function apply()
$this->config->saveConfig($path, $value, 'default', 0);
}

/** @var \Magento\Framework\Indexer\IndexerInterface $indexer */
$indexer = $this->indexerFactory->create()->load('algolia_products');
$subscriptionInstance = $this->subscriptionFactory->create(
[
'view' => $indexer->getView(),
'tableName' => 'catalog_product_index_price',
'columnName' => 'entity_id',
]
);
$subscriptionInstance->remove();

$this->moduleDataSetup->getConnection()->endSetup();
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Algolia Search integration for Magento 2",
"type": "magento2-module",
"license": ["MIT"],
"version": "3.6.1",
"version": "3.7.0",
"require": {
"magento/framework": "~102.0|~103.0",
"algolia/algoliasearch-client-php": "^3.2",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Algolia_AlgoliaSearch" setup_version="3.6.1">
<module name="Algolia_AlgoliaSearch" setup_version="3.7.0">
<sequence>
<module name="Magento_Theme"/>
<module name="Magento_Backend"/>
Expand Down
43 changes: 18 additions & 25 deletions view/frontend/web/internals/algoliaBundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion view/frontend/web/internals/algoliaBundle.min.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions view/frontend/web/internals/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ requirejs(['algoliaBundle'], function(algoliaBundle) {
return template;
},
suggestion: function (hit, payload) {
var toEscape = hit._highlightResult.name.value;
hit._highlightResult.name.value = algoliaBundle.autocomplete.escapeHighlightedString(toEscape);
hit.__indexName = algoliaConfig.indexName + "_" + section.name;
hit.__queryID = payload.queryID;
hit.__position = payload.hits.indexOf(hit) + 1;
Expand Down

0 comments on commit d333c95

Please sign in to comment.