/**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1') < 0) {
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
         $attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
         $attributeGroup = $categorySetup->getAttributeGroup($entityTypeId, $attributeSetId, 'Images', 'attribute_group_name');
         if (isset($attributeGroup['attribute_group_name']) && $attributeGroup['attribute_group_name'] == 'Images') {
             // update General Group
             $categorySetup->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroup['attribute_group_id'], 'attribute_group_name', 'Images and Videos');
         }
     }
     if ($context->getVersion() && version_compare($context->getVersion(), '2.0.1') < 0) {
         $select = $setup->getConnection()->select()->from($setup->getTable('catalog_product_entity_group_price'), ['entity_id', 'all_groups', 'customer_group_id', new \Zend_Db_Expr('1'), 'value', 'website_id']);
         $select = $setup->getConnection()->insertFromSelect($select, $setup->getTable('catalog_product_entity_tier_price'), ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'value', 'website_id']);
         $setup->getConnection()->query($select);
         $categorySetupManager = $this->categorySetupFactory->create();
         $categorySetupManager->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price');
     }
     if (version_compare($context->getVersion(), '2.0.2') < 0) {
         // set new resource model paths
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'entity_model', 'Magento\\Catalog\\Model\\ResourceModel\\Category');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'entity_attribute_collection', 'Magento\\Catalog\\Model\\ResourceModel\\Category\\Attribute\\Collection');
         $categorySetup->updateAttribute(\Magento\Catalog\Model\Category::ENTITY, 'custom_design_from', 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'entity_model', 'Magento\\Catalog\\Model\\ResourceModel\\Product');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'entity_attribute_collection', 'Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection');
     }
     $setup->endSetup();
 }
Example #2
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if ($context->getVersion() && version_compare($context->getVersion(), '2.0.1') < 0) {
         $select = $setup->getConnection()->select()->from($setup->getTable('catalog_product_entity_group_price'), ['entity_id', 'all_groups', 'customer_group_id', new \Zend_Db_Expr('1'), 'value', 'website_id']);
         $select = $setup->getConnection()->insertFromSelect($select, $setup->getTable('catalog_product_entity_tier_price'), ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'value', 'website_id']);
         $setup->getConnection()->query($select);
         $categorySetupManager = $this->categorySetupFactory->create();
         $categorySetupManager->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price');
     }
     if (version_compare($context->getVersion(), '2.0.2') < 0) {
         // set new resource model paths
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'entity_model', 'Magento\\Catalog\\Model\\ResourceModel\\Category');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'entity_attribute_collection', 'Magento\\Catalog\\Model\\ResourceModel\\Category\\Attribute\\Collection');
         $categorySetup->updateAttribute(\Magento\Catalog\Model\Category::ENTITY, 'custom_design_from', 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'entity_model', 'Magento\\Catalog\\Model\\ResourceModel\\Product');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'entity_attribute_collection', 'Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection');
     }
     if (version_compare($context->getVersion(), '2.0.3') < 0) {
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $categorySetup->updateAttribute(3, 51, 'default_value', 1);
     }
     if (version_compare($context->getVersion(), '2.0.4') < 0) {
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $categorySetup->updateAttribute('catalog_product', 'media_gallery', 'backend_type', 'static');
         $categorySetup->updateAttribute('catalog_product', 'media_gallery', 'backend_model');
     }
     $setup->endSetup();
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /**
      * Add 'gift_message_id' attributes for entities
      */
     $options = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'visible' => false, 'required' => false];
     $entities = ['quote', 'quote_address', 'quote_item', 'quote_address_item'];
     foreach ($entities as $entity) {
         /** @var \Magento\Quote\Setup\QuoteSetup $quoteSetup */
         $quoteSetup = $this->quoteSetupFactory->create(['setup' => $setup]);
         $quoteSetup->addAttribute($entity, 'gift_message_id', $options);
     }
     /** @var \Magento\Sales\Setup\SalesSetup $salesSetup */
     $salesSetup = $this->salesSetupFactory->create(['setup' => $setup]);
     $salesSetup->addAttribute('order', 'gift_message_id', $options);
     $salesSetup->addAttribute('order_item', 'gift_message_id', $options);
     /**
      * Add 'gift_message_available' attributes for entities
      */
     $salesSetup->addAttribute('order_item', 'gift_message_available', $options);
     /** @var \Magento\Catalog\Setup\CategorySetup $catalogSetup */
     $catalogSetup = $this->categorySetupFactory->create(['setup' => $setup]);
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'gift_message_available', ['group' => 'Gift Options', 'backend' => 'Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Boolean', 'frontend' => '', 'label' => 'Allow Gift Message', 'input' => 'select', 'class' => '', 'source' => 'Magento\\Catalog\\Model\\Product\\Attribute\\Source\\Boolean', 'global' => true, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => '', 'apply_to' => '', 'input_renderer' => 'Magento\\GiftMessage\\Block\\Adminhtml\\Product\\Helper\\Form\\Config', 'visible_on_front' => false, 'is_used_in_grid' => true, 'is_visible_in_grid' => false, 'is_filterable_in_grid' => false]);
     $groupName = 'Autosettings';
     $entityTypeId = $catalogSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
     $attributeSetId = $catalogSetup->getAttributeSetId($entityTypeId, 'Default');
     $attribute = $catalogSetup->getAttribute($entityTypeId, 'gift_message_available');
     if ($attribute) {
         $catalogSetup->addAttributeToGroup($entityTypeId, $attributeSetId, $groupName, $attribute['attribute_id'], 60);
     }
 }
Example #4
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.0.2') < 0) {
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
         $attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
         $attributeGroup = $categorySetup->getAttributeGroup($entityTypeId, $attributeSetId, 'image-management');
         if (isset($attributeGroup['attribute_group_name']) && $attributeGroup['attribute_group_name'] == 'Image Management') {
             // update General Group
             $categorySetup->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroup['attribute_group_id'], 'attribute_group_name', 'Images and Videos');
         }
     }
     $setup->endSetup();
 }
 /**
  * {@inheritdoc}
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $groupName = 'Gift Options';
         if (!$categorySetup->getAttributeGroup(Product::ENTITY, 'Default', $groupName)) {
             $categorySetup->addAttributeGroup(Product::ENTITY, 'Default', $groupName, 60);
         }
         $entityTypeId = $categorySetup->getEntityTypeId(Product::ENTITY);
         $attributeSetId = $categorySetup->getAttributeSetId($entityTypeId, 'Default');
         $attribute = $categorySetup->getAttribute($entityTypeId, 'gift_message_available');
         $categorySetup->addAttributeToGroup($entityTypeId, $attributeSetId, $groupName, $attribute['attribute_id'], 10);
     }
     $setup->endSetup();
 }
Example #6
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if ($context->getVersion() && version_compare($context->getVersion(), '0.0.2') < 0) {
         $admin = $this->storeManager->getStore('admin')->getId();
         $default = $this->storeManager->getStore('default')->getId();
         $catalogSetup = $this->catalogSetupFactory->create(['setup' => $setup]);
         $catalogSetup->addAttribute(Product::ENTITY, 'example_multiselect', ['label' => 'Example Multi-Select', 'input' => 'multiselect', 'visible_on_front' => 1, 'backend' => ArrayBackend::class, 'required' => 0, 'global' => CatalogAttribute::SCOPE_STORE, 'option' => ['order' => ['option1' => 10, 'options2' => 20], 'value' => ['option1' => [$admin => 'Admin Label 1', $default => 'Frontend Label 1'], 'option2' => [$admin => 'Admin Label 2', $default => 'Frontend Label 2']]]]);
     }
     if ($context->getVersion() && version_compare($context->getVersion(), '0.0.3') < 0) {
         $catalogSetup = $this->catalogSetupFactory->create(['setup' => $setup]);
         $catalogSetup->updateAttribute(Product::ENTITY, 'example_multiselect', ['frontend_model' => \Training\Orm\Entity\Attribute\Frontend\HtmlList::class, 'is_html_allowed_on_front' => 1]);
     }
     if ($context->getVersion() && version_compare($context->getVersion(), '0.0.4') < 0) {
         $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
         $customerSetup->addAttribute(Customer::ENTITY, 'priority', ['label' => 'Priority', 'type' => 'int', 'input' => 'select', 'source' => \Training\Orm\Entity\Attribute\Source\CustomerPriority::class, 'required' => 0, 'system' => 0, 'position' => 100]);
         $customerSetup->getEavConfig()->getAttribute('customer', 'priority')->setData('used_in_forms', ['adminhtml_customer'])->save();
     }
     if ($context->getVersion() && version_compare($context->getVersion(), '0.0.5') < 0) {
         $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
         $customerSetup->getEavConfig()->getAttribute('customer', 'priority')->setData('used_in_forms', ['adminhtml_customer', 'customer_account_create', 'customer_account_edit'])->save();
     }
     $setup->endSetup();
 }
Example #7
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
     $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
     $categorySetup->installEntities();
     // Create Root Catalog Node
     $categorySetup->createCategory()->load(1)->setId(1)->setStoreId(0)->setPath('1')->setLevel(0)->setPosition(0)->setChildrenCount(0)->setName('Root Catalog')->setInitialSetupFlag(true)->save();
     $category = $categorySetup->createCategory();
     $categorySetup->createCategory()->setStoreId(0)->setPath('1')->setName('Default Category')->setDisplayMode('PRODUCTS')->setAttributeSetId($category->getDefaultAttributeSetId())->setIsActive(1)->setLevel(1)->setInitialSetupFlag(true)->save();
     $data = ['scope' => 'default', 'scope_id' => 0, 'path' => \Magento\Catalog\Helper\Category::XML_PATH_CATEGORY_ROOT_ID, 'value' => $category->getId()];
     $setup->getConnection()->insertOnDuplicate($setup->getTable('core_config_data'), $data, ['value']);
     $categorySetup->addAttributeGroup(\Magento\Catalog\Model\Product::ENTITY, 'Default', 'Design', 6);
     $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Category::ENTITY);
     $attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
     $attributeGroupId = $categorySetup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
     // update General Group
     $categorySetup->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'sort_order', '10');
     $groups = ['display' => ['name' => 'Display Settings', 'sort' => 20, 'id' => null], 'design' => ['name' => 'Custom Design', 'sort' => 30, 'id' => null]];
     foreach ($groups as $k => $groupProp) {
         $categorySetup->addAttributeGroup($entityTypeId, $attributeSetId, $groupProp['name'], $groupProp['sort']);
         $groups[$k]['id'] = $categorySetup->getAttributeGroupId($entityTypeId, $attributeSetId, $groupProp['name']);
     }
     // update attributes group and sort
     $attributes = ['custom_design' => ['group' => 'design', 'sort' => 10], 'custom_design_from' => ['group' => 'design', 'sort' => 30], 'custom_design_to' => ['group' => 'design', 'sort' => 40], 'page_layout' => ['group' => 'design', 'sort' => 50], 'custom_layout_update' => ['group' => 'design', 'sort' => 60], 'display_mode' => ['group' => 'display', 'sort' => 10], 'landing_page' => ['group' => 'display', 'sort' => 20], 'is_anchor' => ['group' => 'display', 'sort' => 30], 'available_sort_by' => ['group' => 'display', 'sort' => 40], 'default_sort_by' => ['group' => 'display', 'sort' => 50]];
     foreach ($attributes as $attributeCode => $attributeProp) {
         $categorySetup->addAttributeToGroup($entityTypeId, $attributeSetId, $groups[$attributeProp['group']]['id'], $attributeCode, $attributeProp['sort']);
     }
     /**
      * Install product link types
      */
     $data = [['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, 'code' => 'relation'], ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, 'code' => 'up_sell'], ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL, 'code' => 'cross_sell']];
     foreach ($data as $bind) {
         $setup->getConnection()->insertForce($setup->getTable('catalog_product_link_type'), $bind);
     }
     /**
      * install product link attributes
      */
     $data = [['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, 'product_link_attribute_code' => 'position', 'data_type' => 'int'], ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, 'product_link_attribute_code' => 'position', 'data_type' => 'int'], ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL, 'product_link_attribute_code' => 'position', 'data_type' => 'int']];
     $setup->getConnection()->insertMultiple($setup->getTable('catalog_product_link_attribute'), $data);
     /**
      * Remove Catalog specified attribute options (columns) from eav/attribute table
      *
      */
     $describe = $setup->getConnection()->describeTable($setup->getTable('catalog_eav_attribute'));
     foreach ($describe as $columnData) {
         if ($columnData['COLUMN_NAME'] == 'attribute_id') {
             continue;
         }
         $setup->getConnection()->dropColumn($setup->getTable('eav_attribute'), $columnData['COLUMN_NAME']);
     }
     $newGeneralTabName = 'Product Details';
     $newPriceTabName = 'Advanced Pricing';
     $newImagesTabName = 'Image Management';
     $newMetaTabName = 'Search Engine Optimization';
     $autosettingsTabName = 'Autosettings';
     $tabNames = ['General' => ['attribute_group_name' => $newGeneralTabName, 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newGeneralTabName)), 'tab_group_code' => 'basic', 'sort_order' => 10], 'Images' => ['attribute_group_name' => $newImagesTabName, 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newImagesTabName)), 'tab_group_code' => 'basic', 'sort_order' => 20], 'Meta Information' => ['attribute_group_name' => $newMetaTabName, 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newMetaTabName)), 'tab_group_code' => 'basic', 'sort_order' => 30], 'Prices' => ['attribute_group_name' => $newPriceTabName, 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newPriceTabName)), 'tab_group_code' => 'advanced', 'sort_order' => 40], 'Design' => ['attribute_group_code' => 'design', 'tab_group_code' => 'advanced', 'sort_order' => 50]];
     $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
     $attributeSetId = $categorySetup->getAttributeSetId($entityTypeId, 'Default');
     //Rename attribute tabs
     foreach ($tabNames as $tabName => $tab) {
         $groupId = $categorySetup->getAttributeGroupId($entityTypeId, $attributeSetId, $tabName);
         if ($groupId) {
             foreach ($tab as $propertyName => $propertyValue) {
                 $categorySetup->updateAttributeGroup($entityTypeId, $attributeSetId, $groupId, $propertyName, $propertyValue);
             }
         }
     }
     //Add new tab
     $categorySetup->addAttributeGroup($entityTypeId, $attributeSetId, $autosettingsTabName, 60);
     $categorySetup->updateAttributeGroup($entityTypeId, $attributeSetId, 'Autosettings', 'attribute_group_code', 'autosettings');
     $categorySetup->updateAttributeGroup($entityTypeId, $attributeSetId, 'Autosettings', 'tab_group_code', 'advanced');
     //New attributes order and properties
     $properties = ['is_required', 'default_value', 'frontend_input_renderer'];
     $attributesOrder = ['name' => [$newGeneralTabName => 10], 'sku' => [$newGeneralTabName => 20], 'price' => [$newGeneralTabName => 30], 'image' => [$newGeneralTabName => 50], 'weight' => [$newGeneralTabName => 70, 'is_required' => 0], 'category_ids' => [$newGeneralTabName => 80], 'description' => [$newGeneralTabName => 90, 'is_required' => 0], 'status' => [$newGeneralTabName => 100, 'is_required' => 0, 'default_value' => 1, 'frontend_input_renderer' => 'Magento\\Framework\\Data\\Form\\Element\\Hidden'], 'short_description' => [$autosettingsTabName => 0, 'is_required' => 0], 'visibility' => [$autosettingsTabName => 20, 'is_required' => 0], 'news_from_date' => [$autosettingsTabName => 30], 'news_to_date' => [$autosettingsTabName => 40], 'country_of_manufacture' => [$autosettingsTabName => 50]];
     foreach ($attributesOrder as $key => $value) {
         $attribute = $categorySetup->getAttribute($entityTypeId, $key);
         if ($attribute) {
             foreach ($value as $propertyName => $propertyValue) {
                 if (in_array($propertyName, $properties)) {
                     $categorySetup->updateAttribute($entityTypeId, $attribute['attribute_id'], $propertyName, $propertyValue);
                 } else {
                     $categorySetup->addAttributeToGroup($entityTypeId, $attributeSetId, $propertyName, $attribute['attribute_id'], $propertyValue);
                 }
             }
         }
     }
     foreach (['status', 'visibility'] as $attributeCode) {
         $categorySetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'is_required_in_admin_store', '1');
     }
     $categorySetup->updateAttribute(\Magento\Catalog\Model\Category::ENTITY, 'custom_design_from', 'attribute_model', 'Magento\\Catalog\\Model\\Resource\\Eav\\Attribute');
     $categorySetup->updateAttribute(\Magento\Catalog\Model\Category::ENTITY, 'custom_design_from', 'frontend_model', 'Magento\\Eav\\Model\\Entity\\Attribute\\Frontend\\Datetime');
 }
Example #8
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup;
     $installer->startSetup();
     $catalogSetup = $this->categorySetupFactory->create(['setup' => $setup]);
     /* ------ shipperhq_shipping_group -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_shipping_group', ['type' => 'text', 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend', 'input' => 'multiselect', 'label' => 'Shipping Group', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     /* ------ shipperhq_warehouse -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_warehouse', ['type' => 'text', 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend', 'input' => 'multiselect', 'label' => 'Origin', 'global' => false, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     $entityTypeId = $catalogSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
     $attributeSetArr = $catalogSetup->getAllAttributeSetIds($entityTypeId);
     $stdAttributeCodes = ['shipperhq_shipping_group' => '1', 'shipperhq_warehouse' => '10'];
     foreach ($attributeSetArr as $attributeSetId) {
         $catalogSetup->addAttributeGroup($entityTypeId, $attributeSetId, 'Shipping', '99');
         $attributeGroupId = $catalogSetup->getAttributeGroupId($entityTypeId, $attributeSetId, 'Shipping');
         foreach ($stdAttributeCodes as $code => $sort) {
             $attributeId = $catalogSetup->getAttributeId($entityTypeId, $code);
             $catalogSetup->addAttributeToGroup($entityTypeId, $attributeSetId, $attributeGroupId, $attributeId, $sort);
         }
     }
     /** @var \Magento\Quote\Setup\QuoteSetup $quoteSetup */
     $quoteSetup = $this->quoteSetupFactory->create(['setup' => $setup]);
     $salesSetup = $this->salesSetupFactory->create(['setup' => $setup]);
     $carrier_type = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Carrier Type'];
     $entities = ['quote_address', 'quote_address_rate'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carrier_type', $carrier_type);
     }
     $salesSetup->addAttribute('order', 'carrier_type', $carrier_type);
     $carrier_id = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Carrier ID'];
     $entities = ['quote_address_rate', 'quote_address'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carrier_id', $carrier_id);
     }
     $salesSetup->addAttribute('order', 'carrier_id', $carrier_id);
     $carrier_group_id = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'Carrier Group ID'];
     $entities = ['quote_address_rate', 'quote_item', 'quote_address_item'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carriergroup_id', $carrier_group_id);
     }
     $salesSetup->addAttribute('order_item', 'carriergroup_id', $carrier_group_id);
     $carrier_group = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Carrier Group'];
     $entities = ['quote_address_rate', 'quote_item', 'quote_address_item'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carriergroup', $carrier_group);
     }
     $salesSetup->addAttribute('order_item', 'carriergroup', $carrier_group);
     $carrierGroupDetails = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Carrier Group Details'];
     $entities = ['quote_address_rate', 'quote_address'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carriergroup_shipping_details', $carrierGroupDetails);
     }
     $salesSetup->addAttribute('order', 'carriergroup_shipping_details', $carrierGroupDetails);
     $isCheckout = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'visible' => false, 'required' => true, 'default' => 0, 'comment' => 'ShipperHQ Checkout Flag'];
     $quoteSetup->addAttribute('quote_address', 'is_checkout', $isCheckout);
     $splitRates = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'visible' => false, 'required' => true, 'default' => 0, 'comment' => 'ShipperHQ Split Rates Flag'];
     $quoteSetup->addAttribute('quote_address', 'split_rates', $splitRates);
     $displayMerged = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'visible' => false, 'required' => true, 'default' => 1, 'comment' => 'ShipperHQ Checkout Display Type'];
     $quoteSetup->addAttribute('quote_address', 'checkout_display_merged', $displayMerged);
     $carriergroupHtml = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Carrier Group HTML'];
     $quoteSetup->addAttribute('quote_address', 'carriergroup_shipping_html', $carriergroupHtml);
     $salesSetup->addAttribute('order', 'carriergroup_shipping_html', $carriergroupHtml);
     $carriergroupShipping = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Shipping Description'];
     $entities = ['quote_item', 'quote_address_item'];
     foreach ($entities as $entity) {
         $quoteSetup->addAttribute($entity, 'carriergroup_shipping', $carriergroupShipping);
     }
     $salesSetup->addAttribute('order_item', 'carriergroup_shipping', $carriergroupShipping);
     $this->configStorageWriter->save('carriers/shipper/ignore_empty_zip', 1);
 }
Example #9
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup;
     $installer->startSetup();
     $catalogSetup = $this->categorySetupFactory->create(['setup' => $setup]);
     /* ------ shipperhq_shipping_fee -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_shipping_fee', ['type' => 'decimal', 'backend' => 'Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Price', 'input' => 'price', 'label' => 'Shipping Fee', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     /* ------ shipperhq_handling_fee -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_handling_fee', ['type' => 'decimal', 'backend' => 'Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Price', 'input' => 'price', 'label' => 'Handling Fee', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     /* ------ shipperhq_volume_weight -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_volume_weight', ['type' => 'varchar', 'input' => 'text', 'label' => 'Volume Weight', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false, 'note' => 'This value is only used in conjunction with shipping filters']);
     /* ------ shipperhq_declared_value -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_declared_value', ['type' => 'decimal', 'backend' => 'Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Price', 'input' => 'price', 'label' => 'Declared Value', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false, 'note' => 'The deemed cost of this product for customs & insurance purposes']);
     /* ------ ship_separately -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'ship_separately', ['type' => 'int', 'input' => 'boolean', 'label' => 'Ship Separately', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     /* ------ shipperhq_dim_group -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_dim_group', ['type' => 'int', 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend', 'frontend' => '', 'label' => 'ShipperHQ Dimensional Rule Group', 'input' => 'select', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     /* ------ ship_length -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'ship_length', ['type' => 'decimal', 'input' => 'text', 'label' => 'Dimension Length', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     /* ------ ship_width -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'ship_width', ['type' => 'decimal', 'input' => 'text', 'label' => 'Dimension Width', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     /* ------ ship_height -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'ship_height', ['type' => 'decimal', 'input' => 'text', 'label' => 'Dimension Height', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     /* ------ shipperhq_poss_boxes -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_poss_boxes', ['type' => 'text', 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend', 'input' => 'multiselect', 'label' => 'Possible Packing Boxes', 'global' => false, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     /* ------ shipperhq_malleable_product -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_malleable_product', ['type' => 'int', 'input' => 'boolean', 'label' => 'Malleable Product', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false, 'note' => 'Ignore if unsure. Indicates the product dimensions can be adjusted to fit box']);
     /* ------ shipperhq_master_boxes -------- */
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_master_boxes', ['type' => 'text', 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend', 'input' => 'multiselect', 'label' => 'Master Packing Boxes', 'global' => false, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     $entityTypeId = $catalogSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
     $attributeSetArr = $catalogSetup->getAllAttributeSetIds($entityTypeId);
     $dimAttributeCodes = ['ship_separately' => '2', 'shipperhq_dim_group' => '1', 'ship_length' => '10', 'ship_width' => '11', 'ship_height' => '12', 'shipperhq_poss_boxes' => '20'];
     foreach ($attributeSetArr as $attributeSetId) {
         $catalogSetup->addAttributeGroup($entityTypeId, $attributeSetId, 'Dimensional Shipping', '100');
         $attributeGroupId = $catalogSetup->getAttributeGroupId($entityTypeId, $attributeSetId, 'Dimensional Shipping');
         foreach ($dimAttributeCodes as $code => $sort) {
             $attributeId = $catalogSetup->getAttributeId($entityTypeId, $code);
             $catalogSetup->addAttributeToGroup($entityTypeId, $attributeSetId, $attributeGroupId, $attributeId, $sort);
         }
     }
     $catalogSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipperhq_availability_date', ['type' => 'datetime', 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\Datetime', 'input' => 'date', 'label' => 'Availability Date', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'visible_on_front' => false, 'is_html_allowed_on_front' => false, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'is_configurable' => false, 'unique' => false, 'user_defined' => true, 'used_in_product_listing' => false]);
     /** @var \Magento\Quote\Setup\QuoteSetup $quoteSetup */
     $quoteSetup = $this->quoteSetupFactory->create(['setup' => $setup]);
     $salesSetup = $this->salesSetupFactory->create(['setup' => $setup]);
     $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
     $destinationTypeAttr = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Address Type'];
     $quoteSetup->addAttribute('quote_address', 'destination_type', $destinationTypeAttr);
     $salesSetup->addAttribute('order', 'destination_type', $destinationTypeAttr);
     $destinationTypeAddressAttr = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'label' => 'Address Type', 'system' => 0, 'required' => false, 'position' => 100, 'comment' => 'ShipperHQ Address Type'];
     $customerSetup->addAttribute('customer_address', 'destination_type', $destinationTypeAddressAttr);
     $addressValiationStatus = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Address Validation Status'];
     $quoteSetup->addAttribute('quote_address', 'validation_status', $addressValiationStatus);
     $salesSetup->addAttribute('order', 'validation_status', $addressValiationStatus);
     $validationStatusAddressAttr = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'label' => 'Address Validation', 'system' => 0, 'required' => false, 'position' => 101, 'comment' => 'ShipperHQ Address Validation Status'];
     $customerSetup->addAttribute('customer_address', 'validation_status', $validationStatusAddressAttr);
     // add attribute to form
     /** @var  $attribute */
     $attribute = $customerSetup->getEavConfig()->getAttribute('customer_address', 'validation_status');
     $attribute->setData('used_in_forms', ['adminhtml_customer_address']);
     $attribute->save();
     $attribute = $customerSetup->getEavConfig()->getAttribute('customer_address', 'destination_type');
     $attribute->setData('used_in_forms', ['adminhtml_customer_address']);
     $attribute->save();
     //1.0.7
     $dispatchDateAttr = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATE, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Address Type'];
     $quoteSetup->addAttribute('quote_address_rate', 'shq_dispatch_date', $dispatchDateAttr);
     $deliveryDateAttr = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATE, 'visible' => false, 'required' => false, 'comment' => 'ShipperHQ Address Type'];
     $quoteSetup->addAttribute('quote_address_rate', 'shq_delivery_date', $deliveryDateAttr);
     $installer->endSetup();
 }
Example #10
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if ($context->getVersion() && version_compare($context->getVersion(), '2.0.1') < 0) {
         $select = $setup->getConnection()->select()->from($setup->getTable('catalog_product_entity_group_price'), ['entity_id', 'all_groups', 'customer_group_id', new \Zend_Db_Expr('1'), 'value', 'website_id']);
         $select = $setup->getConnection()->insertFromSelect($select, $setup->getTable('catalog_product_entity_tier_price'), ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'value', 'website_id']);
         $setup->getConnection()->query($select);
         $categorySetupManager = $this->categorySetupFactory->create();
         $categorySetupManager->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price');
     }
     if (version_compare($context->getVersion(), '2.0.2') < 0) {
         // set new resource model paths
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'entity_model', 'Magento\\Catalog\\Model\\ResourceModel\\Category');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'entity_attribute_collection', 'Magento\\Catalog\\Model\\ResourceModel\\Category\\Attribute\\Collection');
         $categorySetup->updateAttribute(\Magento\Catalog\Model\Category::ENTITY, 'custom_design_from', 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'entity_model', 'Magento\\Catalog\\Model\\ResourceModel\\Product');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'entity_attribute_collection', 'Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection');
     }
     if (version_compare($context->getVersion(), '2.0.3') < 0) {
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $categorySetup->updateAttribute(3, 54, 'default_value', 1);
     }
     if (version_compare($context->getVersion(), '2.0.4') < 0) {
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $categorySetup->updateAttribute('catalog_product', 'media_gallery', 'backend_type', 'static');
         $categorySetup->updateAttribute('catalog_product', 'media_gallery', 'backend_model');
     }
     if (version_compare($context->getVersion(), '2.0.5', '<')) {
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         //Product Details tab
         $categorySetup->updateAttribute(ProductAttributeInterface::ENTITY_TYPE_CODE, 'status', 'frontend_label', 'Enable Product', 5);
         $categorySetup->updateAttribute(ProductAttributeInterface::ENTITY_TYPE_CODE, 'name', 'frontend_label', 'Product Name');
         $categorySetup->addAttributeToGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Product Details', 'visibility', 80);
         $categorySetup->addAttributeToGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Product Details', 'news_from_date', 90);
         $categorySetup->addAttributeToGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Product Details', 'news_to_date', 100);
         $categorySetup->addAttributeToGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Product Details', 'country_of_manufacture', 110);
         //Content tab
         $categorySetup->addAttributeGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Content', 15);
         $categorySetup->updateAttributeGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Content', 'tab_group_code', 'basic');
         $categorySetup->addAttributeToGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Content', 'description');
         $categorySetup->addAttributeToGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Content', 'short_description', 100);
         //Images tab
         $groupId = (int) $categorySetup->getAttributeGroupByCode(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'image-management', 'attribute_group_id');
         $categorySetup->addAttributeToGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', $groupId, 'image', 1);
         $categorySetup->updateAttributeGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', $groupId, 'attribute_group_name', 'Images');
         $categorySetup->updateAttribute(ProductAttributeInterface::ENTITY_TYPE_CODE, 'image', 'frontend_label', 'Base');
         $categorySetup->updateAttribute(ProductAttributeInterface::ENTITY_TYPE_CODE, 'small_image', 'frontend_label', 'Small');
         $categorySetup->updateAttribute(ProductAttributeInterface::ENTITY_TYPE_CODE, 'image', 'frontend_input_renderer', null);
         //Design tab
         $categorySetup->updateAttribute(ProductAttributeInterface::ENTITY_TYPE_CODE, 'page_layout', 'frontend_label', 'Layout');
         $categorySetup->updateAttribute(ProductAttributeInterface::ENTITY_TYPE_CODE, 'custom_layout_update', 'frontend_label', 'Layout Update XML', 10);
         //Schedule Design Update tab
         $categorySetup->addAttributeGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Schedule Design Update', 55);
         $categorySetup->updateAttributeGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Schedule Design Update', 'tab_group_code', 'advanced');
         $categorySetup->addAttributeToGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Schedule Design Update', 'custom_design_from', 20);
         $categorySetup->addAttributeToGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Schedule Design Update', 'custom_design_to', 30);
         $categorySetup->updateAttribute(ProductAttributeInterface::ENTITY_TYPE_CODE, 'custom_design', 'frontend_label', 'New Theme', 40);
         $categorySetup->addAttributeToGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Schedule Design Update', 'custom_design');
         $categorySetup->addAttribute(ProductAttributeInterface::ENTITY_TYPE_CODE, 'custom_layout', ['type' => 'varchar', 'label' => 'New Layout', 'input' => 'select', 'source' => 'Magento\\Catalog\\Model\\Product\\Attribute\\Source\\Layout', 'required' => false, 'sort_order' => 50, 'global' => ScopedAttributeInterface::SCOPE_STORE, 'group' => 'Schedule Design Update', 'is_used_in_grid' => true, 'is_visible_in_grid' => false, 'is_filterable_in_grid' => false]);
     }
     if (version_compare($context->getVersion(), '2.0.7') < 0) {
         /** @var EavSetup $eavSetupF */
         $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
         $eavSetup->updateAttribute(ProductAttributeInterface::ENTITY_TYPE_CODE, 'meta_description', ['note' => 'Maximum 255 chars. Meta Description should optimally be between 150-160 characters']);
     }
     $setup->endSetup();
 }