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

Commit

Permalink
Merge pull request #73 from DivanteLtd/develop
Browse files Browse the repository at this point in the history
Release 1.8
  • Loading branch information
patzick committed Feb 8, 2019
2 parents f58e459 + e73c40e commit 159e717
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Added
- Setting `configurable_options.label` from the attribute meta descriptor. **Note:** When You modify any configurable attribute label in Magento You should reindex all products now
- Configurable parent refresh sync - enabled in the `productsdelta` and `productsworker` modes and in `products --sku=<singleSku>`. This mode is refreshing the configurable parent product for the simple child which requires update. Its' required to start the `clis.js productsworker` (example call: `test_product_worker.sh`) for processing these parent updates,
- Example calls added: `test_product_delta.sh` - for delta indexer, `test_product_worker.sh` for products worker, `test_fullreindex_multiprocess.sh` for multi process/parallel updates, `test_by_sky.sh` - for single SKU updates.

Expand Down
16 changes: 16 additions & 0 deletions src/adapters/magento/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ const serial = funcs =>
funcs.reduce((promise, func) =>
promise.then(result => func().then(Array.prototype.concat.bind(result))), Promise.resolve([]))

const optionLabel = (attr, optionId) => {
if (attr) {
let opt = attr.options.find((op) => { // TODO: cache it in memory
if (_.toString(op.value) === _.toString(optionId)) {
return op
}
}) // TODO: i18n support with multi website attribute names
return opt ? opt.label : optionId
} else {
return optionId
}
}

class ProductAdapter extends AbstractMagentoAdapter {

constructor(config) {
Expand Down Expand Up @@ -434,6 +447,9 @@ class ProductAdapter extends AbstractMagentoAdapter {
let atr = JSON.parse(serializedAtr); // category object
if (atr != null) {
option.attribute_code = atr.attribute_code;
option.values.map((el) => {
el.label = optionLabel(atr, el.value_index)
} )
logger.info(`Product options for ${atr.attribute_code} for ${item.sku} set`);
item[atr.attribute_code + '_options'] = option.values.map((el) => { return el.value_index } )
}
Expand Down

0 comments on commit 159e717

Please sign in to comment.