@@ -46,21 +46,31 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
46
46
$ entityTypeId = $ categorySetup ->getEntityTypeId (\Magento \Catalog \Model \Product::ENTITY );
47
47
$ attributeSetId = $ categorySetup ->getDefaultAttributeSetId ($ entityTypeId );
48
48
49
- $ attributeGroupId = $ categorySetup ->getAttributeGroupId ($ entityTypeId , $ attributeSetId , 'Images ' );
50
-
51
- // update General Group
52
- $ categorySetup ->updateAttributeGroup (
49
+ $ attributeGroup = $ categorySetup ->getAttributeGroup (
53
50
$ entityTypeId ,
54
51
$ attributeSetId ,
55
- $ attributeGroupId ,
56
- 'attribute_group_name ' ,
57
- 'Images and Videos '
52
+ 'Images ' ,
53
+ 'attribute_group_name '
58
54
);
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
+ ) {
59
70
$ select = $ setup ->getConnection ()->select ()
60
71
->from (
61
72
$ setup ->getTable ('catalog_product_entity_group_price ' ),
62
73
[
63
- 'value_id ' ,
64
74
'entity_id ' ,
65
75
'all_groups ' ,
66
76
'customer_group_id ' ,
@@ -69,11 +79,10 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
69
79
'website_id '
70
80
]
71
81
);
72
- $ setup ->getConnection ()->insertFromSelect (
82
+ $ select = $ setup ->getConnection ()->insertFromSelect (
73
83
$ select ,
74
- $ setup ->getTable ('catalog_product_entity_group_price ' ),
84
+ $ setup ->getTable ('catalog_product_entity_tier_price ' ),
75
85
[
76
- 'value_id ' ,
77
86
'entity_id ' ,
78
87
'all_groups ' ,
79
88
'customer_group_id ' ,
@@ -82,6 +91,8 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
82
91
'website_id '
83
92
]
84
93
);
94
+ $ setup ->getConnection ()->query ($ select );
95
+
85
96
$ categorySetupManager = $ this ->categorySetupFactory ->create ();
86
97
$ categorySetupManager ->removeAttribute (\Magento \Catalog \Model \Product::ENTITY , 'group_price ' );
87
98
}
0 commit comments