Skip to content

Commit 0f351d6

Browse files
author
Maksym Aposov
committed
Merge remote-tracking branch 'origin/MAGETWO-43755' into BugFestW2
2 parents f8a4c72 + c5a1595 commit 0f351d6

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

app/code/Magento/Catalog/Setup/UpgradeData.php

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,31 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
4646
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
4747
$attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
4848

49-
$attributeGroupId = $categorySetup->getAttributeGroupId($entityTypeId, $attributeSetId, 'Images');
50-
51-
// update General Group
52-
$categorySetup->updateAttributeGroup(
49+
$attributeGroup = $categorySetup->getAttributeGroup(
5350
$entityTypeId,
5451
$attributeSetId,
55-
$attributeGroupId,
56-
'attribute_group_name',
57-
'Images and Videos'
52+
'Images',
53+
'attribute_group_name'
5854
);
55+
if (isset($attributeGroup['attribute_group_name']) && $attributeGroup['attribute_group_name'] == 'Images') {
56+
// update General Group
57+
$categorySetup->updateAttributeGroup(
58+
$entityTypeId,
59+
$attributeSetId,
60+
$attributeGroup['attribute_group_id'],
61+
'attribute_group_name',
62+
'Images and Videos'
63+
);
64+
}
65+
}
66+
67+
if ($context->getVersion()
68+
&& version_compare($context->getVersion(), '2.0.1') < 0
69+
) {
5970
$select = $setup->getConnection()->select()
6071
->from(
6172
$setup->getTable('catalog_product_entity_group_price'),
6273
[
63-
'value_id',
6474
'entity_id',
6575
'all_groups',
6676
'customer_group_id',
@@ -69,11 +79,10 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
6979
'website_id'
7080
]
7181
);
72-
$setup->getConnection()->insertFromSelect(
82+
$select = $setup->getConnection()->insertFromSelect(
7383
$select,
74-
$setup->getTable('catalog_product_entity_group_price'),
84+
$setup->getTable('catalog_product_entity_tier_price'),
7585
[
76-
'value_id',
7786
'entity_id',
7887
'all_groups',
7988
'customer_group_id',
@@ -82,6 +91,8 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
8291
'website_id'
8392
]
8493
);
94+
$setup->getConnection()->query($select);
95+
8596
$categorySetupManager = $this->categorySetupFactory->create();
8697
$categorySetupManager->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price');
8798
}

app/code/Magento/Catalog/Setup/UpgradeSchema.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ protected function addForeignKeys(SchemaSetupInterface $setup)
140140
*/
141141
private function addSupportVideoMediaAttributes(SchemaSetupInterface $setup)
142142
{
143+
if ($setup->tableExists(Media::GALLERY_VALUE_TO_ENTITY_TABLE)) {
144+
return;
145+
};
146+
143147
/** Add support video media attribute */
144148
$this->createValueToEntityTable($setup);
145149
/**

0 commit comments

Comments
 (0)