Skip to content

Commit

Permalink
MAGETWO-62560: Catalog Module UpgradeData to 2.1.3 breaks when cost a…
Browse files Browse the repository at this point in the history
…ttribute is deleted #7804 - for 2.2.0
  • Loading branch information
oshmyheliuk committed Feb 28, 2017
1 parent 84d382b commit bb0adaa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/code/Magento/Catalog/Setup/UpgradeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,14 @@ private function changePriceAttributeDefaultScope($categorySetup)
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
foreach (['price', 'cost', 'special_price'] as $attributeCode) {
$attribute = $categorySetup->getAttribute($entityTypeId, $attributeCode);
$categorySetup->updateAttribute(
$entityTypeId,
$attribute['attribute_id'],
'is_global',
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL
);

if (isset($attribute['attribute_id'])) {
$categorySetup->updateAttribute(
$entityTypeId,
$attribute['attribute_id'],
'is_global',
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL
);
}
}
}
}

0 comments on commit bb0adaa

Please sign in to comment.