Skip to content

Commit 8db5db9

Browse files
author
Michail Slabko
committed
MAGETWO-45563: Cannot manually add products to a configurable product
1 parent f56c517 commit 8db5db9

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/product-grid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ define([
135135
*/
136136
close: function (rowIndex) {
137137
try {
138-
if (this.productsMassAction().selected.length) {
138+
if (this.productsMassAction().selected.getLength()) {
139139
this.variationsComponent()[this.callbackName](this.productsMassAction()
140140
.selected.map(this.getProductById.bind(this)));
141141
this.productsMassAction().deselectAll();

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,24 @@ define([
4848
},
4949
showGrid: function (rowIndex) {
5050
var product = this.productMatrix()[rowIndex],
51-
attributes = JSON.parse(product.attribute);
51+
attributes = JSON.parse(product.attribute),
52+
filterModifier = product.productId ? {
53+
'entity_id': {
54+
'condition_type': 'neq', value: product.productId
55+
}
56+
} : {};
5257
this.rowIndexToEdit = rowIndex;
5358

59+
filterModifier = _.extend(filterModifier, _.mapObject(attributes, function (value) {
60+
return {
61+
'condition_type': 'eq',
62+
'value': value
63+
};
64+
}));
5465
this.associatedProductGrid().open(
5566
{
5667
'filters': attributes,
57-
'filters_modifier': product.productId ? {
58-
'entity_id': {
59-
'condition_type': 'neq', value: product.productId
60-
}
61-
} : {}
68+
'filters_modifier': filterModifier
6269
},
6370
'changeProduct',
6471
false

0 commit comments

Comments
 (0)