New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CategoryOrderHints are being imported before the product is linked with a category #163
Comments
@Siilwyn @hisabimbola - this issue is not related only to this module so I was thinking that it should be a part of |
Could you check how the new SDK handles this? |
Sure, will try it |
@Siilwyn - I tested it on a ProductSync from SDK v1.17.6 with this code: var sync = new (require('sphere-node-sdk').ProductSync)()
var _ = require('lodash')
var prod = {
version: 1,
"categories": [],
"categoryOrderHints": {}
}
var prodNew = _.cloneDeep(prod)
prodNew.categories.push({
"typeId": "category",
id: "1234"
})
prodNew.categoryOrderHints["1234"] = "0.234"
var filtered = sync.config({})
.buildActions(prodNew, prod)
console.dir(filtered.getUpdatePayload(), { depth: 100 }) And the output is still wrong: { actions:
[ { action: 'setCategoryOrderHint',
categoryId: '1234',
orderHint: '0.234' },
{ category: { typeId: 'category', id: '1234' },
action: 'addToCategory' } ],
version: 1 } Action |
Whoops sorry Jan, I meant this one: https://github.com/commercetools/nodejs/tree/master/packages/sync-actions |
Yeah, I think this fix should be done in the SDK, and new one too |
@Siilwyn I tested it with the new ProductSync service and it did not even map categoryOrderHint actions: var sync = require('@commercetools/sync-actions').createSyncProducts()
var _ = require('lodash')
var prod = {
version: 1,
categories: [],
categoryOrderHints: {}
}
var prodNew = _.cloneDeep(prod)
prodNew.categories.push({
typeId: "category",
id: "1234"
})
prodNew.categoryOrderHints["1234"] = "0.234"
var filtered = sync.buildActions(prodNew, prod)
console.dir(filtered, { depth: 100 }) And the output is: [ { category: { typeId: 'category', id: '1234' },
action: 'addToCategory' } ] |
We can fix this in the SDK... |
This issue should be fixed by this PR: commercetools/sphere-node-sdk#226 |
This has been fixed in old sdk, we can keep this open till we fix in new sdk too... |
PR which fixes this behaviour in the new SDK is here commercetools/nodejs#162 |
Closing this because all underlying PRs were merged. |
Import should first link products with
categories
and then importcategoryOrderHints
(aka it should sort request actions):The text was updated successfully, but these errors were encountered: