Skip to content

Commit

Permalink
Merge pull request #90 from algolia/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Jan Petr authored Oct 24, 2016
2 parents 9f8d51f + 48878e7 commit 7687a18
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 9 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# CHANGELOG

## 1.0.3

- Fixed issue with indexing content on Magento 2.1 EE and higher (#87)
- Fixed page indexing to index pages only from active stores (#82)

## 1.0.2

- Fixed issue with merging JS files in administration - added new line at the end of [algoliaAdminBundle.min.js](https://github.com/algolia/algoliasearch-magento-2/blob/master/view/adminhtml/web/algoliaAdminBundle.min.js)

## 1.0.1

- Fixed issue with merging JS files - added new line at the end of [algoliaBundle.min.js](https://github.com/algolia/algoliasearch-magento-2/blob/master/view/frontend/web/internals/algoliaBundle.min.js)
Expand Down
5 changes: 5 additions & 0 deletions Helper/ConfigHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ public function getMagentoVersion()
return $this->productMetadata->getVersion();
}

public function getMagentoEdition()
{
return $this->productMetadata->getEdition();
}

public function getExtensionVersion()
{
return $this->moduleResource->getDbVersion('Algolia_AlgoliaSearch');
Expand Down
29 changes: 23 additions & 6 deletions Helper/Entity/BaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ abstract class BaseHelper

protected $storeUrls;

private $idColumn;

abstract protected function getIndexNameSuffix();

public function __construct(Config $eavConfig,
Expand Down Expand Up @@ -210,11 +212,11 @@ public function getCategories()
if ($attribute = $resource->getAttribute('is_active')) {
$connection = $this->queryResource->getConnection();
$select = $connection->select()
->from(['backend' => $attribute->getBackendTable()], ['key' => new \Zend_Db_Expr("CONCAT(backend.store_id, '-', backend.entity_id)"), 'category.path', 'backend.value'])
->join(['category' => $resource->getTable('catalog_category_entity')], 'backend.entity_id = category.entity_id', [])
->from(['backend' => $attribute->getBackendTable()], ['key' => new \Zend_Db_Expr("CONCAT(backend.store_id, '-', backend.".$this->getCorrectIdColumn().")"), 'category.path', 'backend.value'])
->join(['category' => $resource->getTable('catalog_category_entity')], 'backend.'.$this->getCorrectIdColumn().' = category.entity_id', [])
->where('backend.attribute_id = ?', $attribute->getAttributeId())
->order('backend.store_id')
->order('backend.entity_id');
->order('backend.'.$this->getCorrectIdColumn());

self::$_activeCategories = $connection->fetchAssoc($select);
}
Expand Down Expand Up @@ -246,8 +248,8 @@ public function getCategoryName($categoryId, $storeId = null)
$connection = $this->queryResource->getConnection();

$select = $connection->select()
->from(['backend' => $attribute->getBackendTable()], [new \Zend_Db_Expr("CONCAT(backend.store_id, '-', backend.entity_id)"), 'backend.value'])
->join(['category' => $categoryModel->getTable('catalog_category_entity')], 'backend.entity_id = category.entity_id', [])
->from(['backend' => $attribute->getBackendTable()], [new \Zend_Db_Expr("CONCAT(backend.store_id, '-', backend.".$this->getCorrectIdColumn().")"), 'backend.value'])
->join(['category' => $categoryModel->getTable('catalog_category_entity')], 'backend.'.$this->getCorrectIdColumn().' = category.entity_id', [])
->where('backend.attribute_id = ?', $attribute->getAttributeId())
->where('category.level > ?', 1);

Expand Down Expand Up @@ -321,6 +323,21 @@ public function getStoreUrl($store_id)
return $this->storeUrls[$store_id];
}

return;
return null;
}

protected function getCorrectIdColumn()
{
if(isset($this->idColumn)) {
return $this->idColumn;
}

$this->idColumn = 'entity_id';

if ($this->config->getMagentoEdition() !== 'Community' && version_compare($this->config->getMagentoVersion(), '2.1.0', '>=')) {
$this->idColumn = 'row_id';
}

return $this->idColumn;
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This extension replaces the default search of Magento with a typo-tolerant, fast

See features and benefits of [Algolia Search Extension for Magento](https://community.algolia.com/magento).

![Latest version](https://img.shields.io/badge/latest-1.0.1-green.svg)
![Latest version](https://img.shields.io/badge/latest-1.0.3-green.svg)
![Magento 2.0.X](https://img.shields.io/badge/Magento-2.0.X-blue.svg)
![PHP >= 5.5.22](https://img.shields.io/badge/PHP-%3E=5.5.22-green.svg)

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "algolia/algoliasearch-magento-2",
"description": "Algolia Search integration for Magento 2",
"type": "magento2-module",
"version": "1.0.1",
"version": "1.0.3",
"license": ["MIT"],
"require": {
"php": "~5.5.0|~5.6.0|~7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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="1.0.1">
<module name="Algolia_AlgoliaSearch" setup_version="1.0.3">
</module>
</config>

0 comments on commit 7687a18

Please sign in to comment.