Commit 62f0331a by halweg

fix: joshine/category 升级文件修改

parent bc66c035
......@@ -33,47 +33,18 @@ class UpgradeData implements UpgradeDataInterface
{
$setup->startSetup();
if (version_compare($context->getVersion(), '1.0.1') < 0) {
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Category::ENTITY);
$attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
$idg = $categorySetup->getAttributeGroupId($entityTypeId, $attributeSetId, 'Custom Menu');
$categorySetup->addAttribute(
\Magento\Catalog\Model\Category::ENTITY,
'menu_image',
[
'type' => 'varchar',
'label' => 'badge',
'visible_on_front' => true,
'user_defined' => false,
'default' => null,
'group' => 'Custom Menu',
'input' => 'image',
'backend' => 'Magento\Catalog\Model\Category\Attribute\Backend\Image',
'required' => false,
'sort_order' => 70,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
]
);
$categorySetup->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$idg,
'menu_image',
1
);
}
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Category::ENTITY);
$attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
$categorySetup->addAttributeGroup(
\Magento\Catalog\Model\Category::ENTITY,
$categorySetup->getDefaultAttributeSetId(\Magento\Catalog\Model\Category::ENTITY),
'Custom Menu',
99
);
$menu_attributes = [
'submenu_columns_total' =>
[
......@@ -119,7 +90,21 @@ class UpgradeData implements UpgradeDataInterface
'default' => null,
'group' => 'Custom Menu',
'backend' => ''
]
],
'menu_image',
[
'type' => 'varchar',
'label' => 'badge',
'visible_on_front' => true,
'user_defined' => false,
'default' => null,
'group' => 'Custom Menu',
'input' => 'image',
'backend' => 'Magento\Catalog\Model\Category\Attribute\Backend\Image',
'required' => false,
'sort_order' => 70,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
]
];
foreach($menu_attributes as $item => $data) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment