Skip to content

Commit f905c1f

Browse files
authored
Release 3.1.0 (#1130)
1 parent 4762fe2 commit f905c1f

22 files changed

+152
-1569
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ The development team will review all issues and contributions submitted by the c
1818
* Integration test coverage
1919
* Proposed [documentation](https://www.algolia.com/doc/integration/magento-2/getting-started/quick-start/) update
2020
6. All automated tests are passed successfully:
21-
* CircleCI Magento 2.2
2221
* CircleCI Magento 2.3
22+
* CircleCI Magento 2.4
2323
* CircleCI [Quality Tools](https://github.com/algolia/magento2-tools) (phpcs and php compatibility)
2424

2525
# Contribution process

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# CHANGE LOG
22

3+
## 3.1.0
4+
5+
### UPDATES
6+
- Fetch Algolia additional data only in the extension's sections in the Magento config (#1119)
7+
- Remove image URL manipulation (#1120) by @fredden
8+
- Add product source hook to modify search options (#1123)
9+
- Use button element for search button (#1102) by @fredden
10+
- Set Price Calculation to true for every tax field during price calculation (#1124)
11+
- Update maintainers.md with process info (#1128)
12+
- Update algoliaBundle with latest instantsearch version (#1127)
13+
14+
### FIXES
15+
- Fix to keep the price slider values in the filter when user refresh the page (#1121)
16+
- Add missing handle for cms editor layout needed for pagebuilder (#1122)
17+
- Adding credentials check to prevent Magento from crashing on fresh install (#1125)
18+
319
## 3.0.2
420

521
### FEATURES

Helper/Entity/CategoryHelper.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,6 @@ public function getObject(Category $category)
295295
];
296296

297297
if (!empty($imageUrl)) {
298-
$imageUrl = $this->imageHelper->removeProtocol($imageUrl);
299-
$imageUrl = $this->imageHelper->removeDoubleSlashes($imageUrl);
300-
301298
$data['image_url'] = $imageUrl;
302299
}
303300

Helper/Entity/Product/PriceManager/ProductWithoutChildren.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public function addPriceData($customData, Product $product, $subProducts)
6262
foreach ($fields as $field => $withTax) {
6363
$this->customData[$field] = [];
6464

65+
$product->setPriceCalculation(true);
66+
6567
foreach ($currencies as $currencyCode) {
6668
$this->customData[$field][$currencyCode] = [];
6769

Helper/Entity/ProductHelper.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -735,11 +735,7 @@ private function addImageData(array $customData, Product $product, $additionalAt
735735
$images = $product->getMediaGalleryImages();
736736
if ($images) {
737737
foreach ($images as $image) {
738-
$url = $image->getUrl();
739-
$url = $this->imageHelper->removeProtocol($url);
740-
$url = $this->imageHelper->removeDoubleSlashes($url);
741-
742-
$customData['media_gallery'][] = $url;
738+
$customData['media_gallery'][] = $image->getUrl();
743739
}
744740
}
745741
}

Helper/Image.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ public function getUrl()
5252
$url = $this->getDefaultPlaceholderUrl();
5353
}
5454

55-
$url = $this->removeProtocol($url);
56-
$url = $this->removeDoubleSlashes($url);
57-
5855
if ($this->configHelper->shouldRemovePubDirectory()) {
5956
$url = $this->removePubDirectory($url);
6057
}
@@ -110,19 +107,6 @@ private function getConfigurableProductImage()
110107
return null;
111108
}
112109

113-
public function removeProtocol($url)
114-
{
115-
return str_replace(['https://', 'http://'], '//', $url);
116-
}
117-
118-
public function removeDoubleSlashes($url)
119-
{
120-
$url = str_replace('//', '/', $url);
121-
$url = '/' . $url;
122-
123-
return $url;
124-
}
125-
126110
public function removePubDirectory($url)
127111
{
128112
return str_replace('/pub/', '/', $url);

MAINTAINERS.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
## `algolia/algoliasearch-magento-2` maintainers
1+
# Notes for Maintainers
22

3-
| Name | Email |
4-
|------------------------------|---------------------------|
5-
| Jan Petr | [email protected] |
3+
### Testing
4+
- CircleCI test configurations are found in the `.circleci/config.yml` file. For any new Magento versions to test against, you will need to build and push up a new image to be used in CircleCI using this [repository](https://github.com/algolia/magento2-circleci).
5+
- Quality tools can also be upgraded [here](https://github.com/algolia/magento2-tools).
6+
7+
### Approval Process
8+
- All PRs need to have 1 approved reviewer by a maintainer and all testing needs to pass before merging.
9+
- While we have integration testing, we need to manually test all PRs to ensure quality.
10+
11+
### Release Process
12+
- Prepare release notes with all the changes and tagging community members for their contribution.
13+
- Make a **bump** PR to update all the version numbers and merge into `develop`.
14+
- After a bump has been created, you can then merge `develop` into `master`.
15+
- Create a release and tag with your release notes.
16+
17+
### Marketplace
18+
You will need to package the release before uploading to the Magento Marketplace. Run `dev/release.sh` in the extension directory to create the zip file.

Model/Indexer/PageObserver.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,37 @@
22

33
namespace Algolia\AlgoliaSearch\Model\Indexer;
44

5+
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
56
use Magento\Framework\Indexer\IndexerRegistry;
67
use Magento\Framework\Model\AbstractModel;
78

89
class PageObserver
910
{
1011
private $indexer;
1112

12-
public function __construct(IndexerRegistry $indexerRegistry)
13-
{
13+
/**
14+
* @var ConfigHelper
15+
*/
16+
private $configHelper;
17+
18+
public function __construct(
19+
IndexerRegistry $indexerRegistry,
20+
ConfigHelper $configHelper
21+
) {
1422
$this->indexer = $indexerRegistry->get('algolia_pages');
23+
$this->configHelper = $configHelper;
1524
}
1625

1726
public function beforeSave(
1827
\Magento\Cms\Model\ResourceModel\Page $pageResource,
1928
AbstractModel $page
2029
) {
30+
if (!$this->configHelper->getApplicationID()
31+
|| !$this->configHelper->getAPIKey()
32+
|| !$this->configHelper->getSearchOnlyAPIKey()) {
33+
return [$page];
34+
}
35+
2136
$pageResource->addCommitCallback(function () use ($page) {
2237
if (!$this->indexer->isScheduled()) {
2338
$this->indexer->reindexRow($page->getId());
@@ -31,6 +46,12 @@ public function beforeDelete(
3146
\Magento\Cms\Model\ResourceModel\Page $pageResource,
3247
AbstractModel $page
3348
) {
49+
if (!$this->configHelper->getApplicationID()
50+
|| !$this->configHelper->getAPIKey()
51+
|| !$this->configHelper->getSearchOnlyAPIKey()) {
52+
return [$page];
53+
}
54+
3455
$pageResource->addCommitCallback(function () use ($page) {
3556
if (!$this->indexer->isScheduled()) {
3657
$this->indexer->reindexRow($page->getId());

README.md

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

4-
![Latest version](https://img.shields.io/badge/latest-3.0.2-green.svg)
4+
![Latest version](https://img.shields.io/badge/latest-3.1.0-green.svg)
55
![Magento 2](https://img.shields.io/badge/Magento-%32.3,%202.4-blue.svg)
66

77
[![CircleCI](https://circleci.com/gh/algolia/algoliasearch-magento-2/tree/master.svg?style=svg)](https://circleci.com/gh/algolia/algoliasearch-magento-2/tree/master)
@@ -89,7 +89,7 @@ Knowing the version of the library will help you understand what is available in
8989
| --- | --- | --- | --- |
9090
| 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]) |
9191
| 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) |
92-
| v3.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) |
92+
| 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) |
9393

9494
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:
9595

Test/Integration/ProductsIndexingTest.php

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -81,44 +81,6 @@ public function testDefaultIndexableAttributes()
8181
$this->assertEmpty($hit, 'Extra products attributes (' . $extraAttributes . ') are indexed and should not be.');
8282
}
8383

84-
public function testNoProtocolImageUrls()
85-
{
86-
$additionAttributes = $this->configHelper->getProductAdditionalAttributes();
87-
$additionAttributes[] = [
88-
'attribute' => 'media_gallery',
89-
'searchable' => '0',
90-
'retrievable' => '1',
91-
'order' => 'unordered',
92-
];
93-
94-
$this->setConfig(
95-
'algoliasearch_products/products/product_additional_attributes',
96-
$this->getSerializer()->serialize($additionAttributes)
97-
);
98-
99-
/** @var Product $indexer */
100-
$indexer = $this->getObjectManager()->create(Product::class);
101-
$indexer->executeRow($this->getValidTestProduct());
102-
103-
$this->algoliaHelper->waitLastTask();
104-
105-
$results = $this->algoliaHelper->getObjects($this->indexPrefix . 'default_products', [$this->getValidTestProduct()]);
106-
$hit = reset($results['results']);
107-
108-
if (!$hit || !array_key_exists('image_url', $hit)) {
109-
$this->markTestIncomplete('Hit was not returned correctly from Algolia. No Hit to run assetions on.');
110-
}
111-
112-
$this->assertStringStartsWith('//', $hit['image_url']);
113-
$this->assertStringStartsWith('//', $hit['thumbnail_url']);
114-
115-
$this->assertArrayHasKey('media_gallery', $hit);
116-
117-
foreach ($hit['media_gallery'] as $galleryImageUrl) {
118-
$this->assertStringStartsWith('//', $galleryImageUrl);
119-
}
120-
}
121-
12284
public function testNoSpecialPrice()
12385
{
12486
/** @var Product $indexer */

0 commit comments

Comments
 (0)