Skip to content

Commit 4223ef2

Browse files
author
Stanislav Idolov
committed
MAGETWO-71136: Cannot save attribute in product page admin with a related conf product that has different attribute set sharing a multiselect attribute
1 parent 32118bc commit 4223ef2

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,24 +455,33 @@ public function getAttribute($attribute)
455455
return $attribute;
456456
}
457457

458+
/**
459+
* Adding attribute to entity by scope.
460+
*
461+
* @param AbstractAttribute $attribute
462+
* @param string $suffix
463+
* @return $this
464+
*/
465+
public function addAttributeByScope(AbstractAttribute $attribute, $suffix)
466+
{
467+
$attributeCode = $attribute->getAttributeCode();
468+
$this->attributesByScope[$suffix][$attributeCode] = $attribute;
469+
return $this->addAttribute($attribute);
470+
}
471+
458472
/**
459473
* Adding attribute to entity
460474
*
461475
* @param AbstractAttribute $attribute
462-
* @param string|null $suffix
463476
* @return $this
464477
*/
465-
public function addAttribute(AbstractAttribute $attribute, $suffix = null)
478+
public function addAttribute(AbstractAttribute $attribute)
466479
{
467480
$attribute->setEntity($this);
468481
$attributeCode = $attribute->getAttributeCode();
469482

470483
$this->_attributesByCode[$attributeCode] = $attribute;
471484

472-
if ($suffix !== null) {
473-
$this->attributesByScope[$suffix][$attributeCode] = $attribute;
474-
}
475-
476485
if ($attribute->isStatic()) {
477486
$this->_staticAttributes[$attributeCode] = $attribute;
478487
} else {

app/code/Magento/Eav/Model/Entity/AttributeLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function loadAllAttributes(AbstractEntity $resource, DataObject $object =
7070
$attributes = $this->cache->getAttributes($typeCode, $suffix);
7171
if ($attributes) {
7272
foreach ($attributes as $attribute) {
73-
$resource->addAttribute($attribute, $suffix);
73+
$resource->addAttributeByScope($attribute, $suffix);
7474
}
7575
return $resource;
7676
}

0 commit comments

Comments
 (0)