Skip to content

Commit e1d1b4a

Browse files
author
Oleksandr Gorkun
committed
MAGETWO-65466: [Backport] - Issue when deleting item from Product options grid containing more than 20 options - for 2.1
1 parent ef061e6 commit e1d1b4a

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,24 @@ define([
2424
identificationDRProperty: 'option_id'
2525
},
2626

27+
/**
28+
* Cleans options' values from IDs because otherwise wrong IDs will be assigned.
29+
*
30+
* @param {Array} values
31+
* @private
32+
*/
33+
__cleanOptionValuesUp: function (values) {
34+
values.each(function (value) {
35+
delete value['option_id'];
36+
delete value['option_type_id'];
37+
})
38+
},
39+
2740
/** @inheritdoc */
2841
processingInsertData: function (data) {
2942
var options = [],
30-
currentOption;
43+
currentOption,
44+
self = this;
3145

3246
if (!data) {
3347
return;
@@ -42,14 +56,13 @@ define([
4256
if (currentOption.hasOwnProperty('sort_order')) {
4357
delete currentOption['sort_order'];
4458
}
59+
4560
if (currentOption.hasOwnProperty('option_id')) {
4661
delete currentOption['option_id'];
4762
}
63+
4864
if (currentOption.values.length > 0) {
49-
currentOption.values.each(function (optionValue) {
50-
delete optionValue['option_id'];
51-
delete optionValue['option_type_id'];
52-
})
65+
this.__cleanOptionValuesUp(currentOption.values);
5366
}
5467

5568
options.push(currentOption);

0 commit comments

Comments
 (0)