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

Add parent_sku field #84 #152

Closed

Conversation

marcin-dykas
Copy link
Contributor

@marcin-dykas marcin-dykas commented Nov 7, 2019

Added parent_sku field.

e.g.

"parent_sku":["MH01","MH02"]

Added new parent_data data provider Divante\VsbridgeIndexerCatalog\Model\Indexer\DataProvider\Product\ParentData for indices.

@marcin-dykas marcin-dykas mentioned this pull request Nov 7, 2019

$this->searchCriteriaBuilder->addFilters([$this->filterBuilder->create()]);

$searchResult = $this->productRepository->getList($this->searchCriteriaBuilder->create());
Copy link
Contributor

@afirlejczyk afirlejczyk Nov 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of an indexer is to work fast - we don't use repository in indexer (nor filter or search builders), mostly plain SQL.
Please use plain SQL to get SKU for product ids.

You can easily get SKU for products ids with simple SQL.. all data is available in "catalog_product_entity" table.

Please take a look e.g to Product ResourceModel
https://github.com/DivanteLtd/magento2-vsbridge-indexer/blob/develop/src/module-vsbridge-indexer-catalog/Model/ResourceModel/Product.php

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

{
$parentIds = [];

foreach ($indexData as $productId => $productData) {
Copy link
Contributor

@afirlejczyk afirlejczyk Nov 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it's not use by default VSF yet, so exporting parent sku - should be optional.
Please add an option to configuration - so user can choose if we should export parent_sku or not - by default set it to NO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

$parentIds = [];

foreach ($indexData as $productId => $productData) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty line after foreach statement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@afirlejczyk afirlejczyk self-assigned this Nov 12, 2019
@pkarw pkarw requested a review from afirlejczyk December 20, 2019 16:07
@afirlejczyk afirlejczyk changed the title issues/84 - Add parent_sku field Add parent_sku field #84 Apr 3, 2020
@afirlejczyk
Copy link
Contributor

Thanks for your PR.
I resolve conflict with new PR: #257

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants