Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/v1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Agata Firlejczyk committed Jul 10, 2019
2 parents 2e6983e + d4914d5 commit f19e99d
Show file tree
Hide file tree
Showing 107 changed files with 2,204 additions and 563 deletions.
54 changes: 53 additions & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# Changelog

## [Unreleased]

## [1.1.0] (2019.07.10)

### Fixed
- Fix bug causing empty product URL paths - [@indiebytes](https://github.com/indiebytes) ([#63](https://github.com/DivanteLtd/magento2-vsbridge-indexer/issues/63))
- Changed ElasticSearch password to be obscured, encrypted, and considered sensitive (will dump to `env.php` instead of `config.php`) - [@rain2o](https://github.com/rain2o) ([#69](https://github.com/DivanteLtd/magento2-vsbridge-indexer/issues/69))
- Fix exporting values for multiselect option arrays as integers (instead of strings)
- Fix getting stock_status value for products
- Magento Commerce - fix getting configurable_children

### Changed/Improved
- Change mapping for "category.name" field in product type
- Remove dependency from catalog_product_price and cataloginventory_stock indexer. On product save multiple request has been send
- Change "Use Short Catalog Urls" setting option to "Use Catalog Url Keys"
- Add option to generate product/category slug base on Magento Url Key and ID. By default slug (and url_key) field is generated base on NAME and ID.

### Added
- Adding support for video data. Small change will be needed in VSF #19
Expand All @@ -9,6 +23,44 @@ There is not need really, VSF only has to know if `product_count > 0`, so if you
category will be visible in menu sidebar.
- Add support for reviews. Reviews are exported without ratings (VSF does not support ratings for now)
- Add support for custom options.
- Add option to enable/disable exporting data to ES.
- Add ProductCategory indexer to partially update product data in ES (category, category_ids fields). Trigger after changing products positions in category.
- Add the ability to choose between Store ID and Store Code to be used at the end of index names.
- Add label for configurable option value. **Note:** When You modify any configurable attribute label or option label in Magento You should reindex all products manually.
```json
{
"attribute_id": 93,
"attribute_code": "color",
"label": "Color",
"values": [
{
"value_index": 61,
"label": "Gray"
},
{
"value_index": 66,
"label": "Purple"
},
{
"value_index": 69,
"label": "Yellow"
}
]
}
```
- Add new command ```php bin/magento vsbridge:reindex``` which will run all Magento indices which names start with "vsbridge_" (experimental).
```php
Description:
Rebuild indexer in ES.

Usage:
vsbridge:reindex [options]

Options:
--store=STORE Store ID
--delete-index Delete previous index and create new one (with new mapping)
```


## [1.0.0] (2019.04.03)
First version
Expand Down
115 changes: 109 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,61 @@ composer config repositories.divante vcs https://github.com/DivanteLtd/magento2-
composer require divante/magento2-vsbridge-indexer:dev-master
```

## Installation/Getting Started - MSI support
- Install with composer changes from develop branch
```json
composer config repositories.divante vcs https://github.com/DivanteLtd/magento2-vsbridge-indexer
composer require divante/magento2-vsbridge-indexer:dev-develop
```
- Install also second module which will support MSI
```json
composer config repositories.divante-msi vcs https://github.com/DivanteLtd/magento2-vsbridge-indexer-msi
composer require divante/magento2-vsbridge-indexer-msi:dev-develop
```
Not fully supported, few fields are exported to ES.
From inventory indexer:
-- qty => qty,
-- is_salable => is_in_stock/stock_status

#### Example

Website 1
```json
{
"sku": "24-MB01",
"stock": {
"qty": 100,
"is_in_stock": false,
"stock_status": 0
}
}
```

Website 2
```json
{
"sku": "24-MB01",
"stock": {
"qty": 73,
"is_in_stock": true,
"stock_status": 1
}
}
```

```php
php bin/magento setup:upgrade
```
- Configure the module in Magento admin panel and run full indexation


### Configuration
Go to the new ‘Indexer’ section (Stores → Configuration → Vuestorefront → Indexer), available now in the in the Magento Panel, and configure it in the listed areas:
Go to the new ‘Indexer’ section (Stores → Configuration → Vuestorefront → Indexer), available now in the in the Magento Panel, and configure it in the listed areas:
1. General settings → Enable VS Bridge

Enable to export data to elasticsearch. By default indexing is disable.

![](docs/images/config-general-enable.png)

1. General settings → List of stores to reindex

Expand All @@ -49,9 +96,57 @@ Go to the new ‘Indexer’ section (Stores → Configuration → Vuestorefront
Batch Indexing Size → select size of packages by which you intend to send data to ElasticSrearch. Depending on the project you might need to adjust package size to the number of products, attributes, configurable products variation, etc). By default Batch, Indexing Size is set up for 1000.
Indicies settings

Index Name Prefix → define prefixes for ElasticSearch indexes. The panel allows adding prefix only to the catalog name e.g.: "vue_storefront_catalog". For each store (store view) index name is generated on the base of defined prefix and ID. Aliases cannot be created.
Example: When we define following indexes: "vue_storefront_catalog_1", "vue_storefront_catalog_2", "vue_storefront_catalog_3", their name will remain unchanged, and only product and category names will be updated.
Index Name Prefix → define prefixes for ElasticSearch indexes. The panel allows adding prefix only to the catalog name e.g.: "vue_storefront_catalog". For each store (store view) index name is generated on the base of defined prefix and either ID or Store Code. Aliases cannot be created.
Example: When we define following indexes: "vue_storefront_catalog_1", "vue_storefront_catalog_2", "vue_storefront_catalog_3".
Important: It is crucial to update this configuration in the VSF and VSF-API (one change at the beginning of the whole configuration process).

Index Identifier → defines the unique store identifier to append to the ElasticSearch indexes. The default value is ID which will append the Store ID to the index name e.g.: "vue_storefront_catalog_1". You can choose to change this to Store Code which will add the Store Code to the index name e.g.: "vue_storefront_catalog_storecode".

Example with Store ID

VSF config (base on default index prefix name: vue_storefront_magento)
```json
"elasticsearch": {
"httpAuth": "",
"host": "localhost:8080/api/catalog",
"index": "vue_storefront_magento_1" //index for store view with id 1
}
```

VSF-API config
```json
"elasticsearch": {
"host": "localhost",
"port": 9200,
"user": "elastic",
"password": "changeme",
"indices": [
"vue_storefront_magento_1" //index for store view with id 1
],
```

Example with Store Code

VSF config (base on default index prefix name: vue_storefront_magento)
```json
"elasticsearch": {
"httpAuth": "",
"host": "localhost:8080/api/catalog",
"index": "vue_storefront_magento_en_us" //index for store view with code "en_us"
}
```

VSF-API config
```json
"elasticsearch": {
"host": "localhost",
"port": 9200,
"user": "elastic",
"password": "changeme",
"indices": [
"vue_storefront_magento_en_us" //index for store view with store code "en_us"
],
```

![](docs/images/config-indices.png)

Expand All @@ -69,7 +164,9 @@ Go to the new ‘Indexer’ section (Stores → Configuration → Vuestorefront

1. Catalog Settings

Use Short Catalog Urls → by default this option is disabled. The short Catalog Urls must be aligned with the VSF configuration. After any changes in the VSF configuration, the configuration in the Magento Panel must be updated and all products and categories indexed anew.
Use Catalog Url Keys → by default this option is disabled. Use Magento Url Key attribute for url_key and slug field (for products and categories). Url Keys have to be unique

Use Magento Url Key and ID to generate slug for VSF -> by default slug (and url_key) field is generated base on product/category NAME and ID

Sync Tier Prices → by default this option is disabled. Used to sync products tier prices.

Expand Down Expand Up @@ -103,6 +200,12 @@ Recommended for smaller databases. In the case of big databases it is better to
php bin/magento indexer:reindex
```

or
```php
php bin/magento vsbridge:reindex --store=[STORE_ID]
php bin/magento vsbridge:reindex --store=1
```

Note: If a docker with ElasticSearch is disabled, Indexer will display error: "No alive nodes found in your cluster".

#### Update on Save Mode
Expand All @@ -121,16 +224,16 @@ Note: If a docker with ElasticSearch is disabled, Indexer will display error: "N

### Compatibility

-- Vue Storefront >= 1.4.4
Module was tested on:
-- Magento Community version 2.2.0 and 2.2.4. It should perform without any issues on all Magento 2.2.x versions.
-- Magento Community version 2.2.7 It should perform without any issues on Magento 2.2.6 and above versions.
-- Magento Enterprise version 2.3.0. The bridge indexer cannot be installed on lower versions of Magento Enterprise.

Module was not tested on version 2.3.

### TODO
- check the Vue Storefront - Magento 2 Indexer bridge for Magento 2.3 (for Commerce and Enterprise versions).
- add MSI support
- add rating review to ElasticSearch as a separate module @Agata
- add a limitation of the attributes (products, categories) sent to ElasticSearch
- add a limitation of the categories sent to ElasticSearch, by adding new configurations: send only categories visible in the menu, send only active categories @Agata
- add a new command enabling the full indexation, which will run all the indexes necessary for VSF
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"magento/module-backend": ">=100.2.0",
"magento/module-catalog": ">=102.0.0",
"magento/magento-composer-installer": "*",
"elasticsearch/elasticsearch": "~5.1"
"elasticsearch/elasticsearch": "~5.1|~6.1"
},
"replace": {
"divante/module-vsf-indexer-core": "self.version",
Expand Down
Binary file modified docs/images/config-catalog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/config-general-enable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/config-indices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* @package Divante\VsbridgeIndexerCatalog
* @author Agata Firlejczyk <[email protected]>
* @copyright 2019 Divante Sp. z o.o.
* @license See LICENSE_DIVANTE.txt for license details.
*/

namespace Divante\VsbridgeIndexerCatalog\Api;

/**
* Interface ApplyCategorySlugInterface
*/
interface ApplyCategorySlugInterface
{
/**
* @param array $category
*
* @return array
*/
public function execute(array $category);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/**
* @package Divante\VsbridgeIndexerCatalog
* @author Agata Firlejczyk <[email protected]>
* @copyright 2019 Divante Sp. z o.o.
* @license See LICENSE_DIVANTE.txt for license details.
*/

namespace Divante\VsbridgeIndexerCatalog\Api\Data;

/**
* Interface CatalogConfigurationInterface
*/
interface CatalogConfigurationInterface
{
const CATALOG_SETTINGS_XML_PREFIX = 'vsbridge_indexer_settings/catalog_settings';

/**
* @return bool
*/
public function useMagentoUrlKeys();

/**
* @return bool
*/
public function useUrlKeyToGenerateSlug();

/**
* @return bool
*/
public function syncTierPrices();

/**
* @param int $storeId
*
* @return array
*/
public function getAllowedProductTypes($storeId);

/**
*
* @return array
* @throws \Exception
*/
public function getAttributesUsedForSortBy();

/**
* @param int $storeId
*
* @return string
*/
public function getProductListDefaultSortBy($storeId);
}
19 changes: 19 additions & 0 deletions src/module-vsbridge-indexer-catalog/Api/LoadInventoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Divante\VsbridgeIndexerCatalog\Api;

/**
* Interface LoadInventoryInterface
*/
interface LoadInventoryInterface
{
/**
* @param array $indexData
* @param iny $storeId
*
* @return array
*/
public function execute(array $indexData, int $storeId): array;
}
24 changes: 24 additions & 0 deletions src/module-vsbridge-indexer-catalog/Api/SlugGeneratorInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* @package Divante\VsbridgeIndexerCatalog
* @author Agata Firlejczyk <[email protected]>
* @copyright 2019 Divante Sp. z o.o.
* @license See LICENSE_DIVANTE.txt for license details.
*/

namespace Divante\VsbridgeIndexerCatalog\Api;

/**
* Interface SlugGeneratorInterface
*/
interface SlugGeneratorInterface
{

/**
* @param string $text
* @param int $id
*
* @return string
*/
public function generate($text, $id);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* @package Divante\VsbridgeIndexerCatalog
* @author Agata Firlejczyk <[email protected]>
* @copyright 2019 Divante Sp. z o.o.
* @license See LICENSE_DIVANTE.txt for license details.
*/

namespace Divante\VsbridgeIndexerCatalog\Console\Command;

use Divante\VsbridgeIndexerCatalog\Model\Indexer\ProductCategoryProcessor;
use Symfony\Component\Console\Input\InputInterface;

/**
* Class IndexerReindexCommand
*/
class IndexerReindexCommand extends \Magento\Indexer\Console\Command\IndexerReindexCommand
{
/**
* @inheritdoc
*/
protected function getIndexers(InputInterface $input)
{
$indexers = parent::getIndexers($input);
unset($indexers[ProductCategoryProcessor::INDEXER_ID]);

return $indexers;
}
}
Loading

0 comments on commit f19e99d

Please sign in to comment.