Пример #1
0
 /**
  * Installs data for a module
  *
  * @param ModuleDataSetupInterface $setup
  * @param ModuleContextInterface   $context
  *
  * @return void
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $eavSetup->addAttribute(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER, 'sf_id', ['type' => 'text', 'visible' => false, 'required' => true, 'unique' => true, 'system' => 0, 'note' => 'Facebook Id']);
     $eavSetup->addAttribute(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER, 'sf_access_token', ['type' => 'text', 'visible' => false, 'required' => true, 'unique' => true, 'system' => 0, 'note' => 'Facebook Access Token']);
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /**
      * Install grouped product link type
      */
     $data = ['link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, 'code' => 'super'];
     $setup->getConnection()->insertOnDuplicate($setup->getTable('catalog_product_link_type'), $data);
     /**
      * Install grouped product link attributes
      */
     $select = $setup->getConnection()->select()->from(['c' => $setup->getTable('catalog_product_link_attribute')])->where("c.link_type_id=?", \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED);
     $result = $setup->getConnection()->fetchAll($select);
     if (!$result) {
         $data = [['link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, 'product_link_attribute_code' => 'position', 'data_type' => 'int'], ['link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, 'product_link_attribute_code' => 'qty', 'data_type' => 'decimal']];
         $setup->getConnection()->insertMultiple($setup->getTable('catalog_product_link_attribute'), $data);
     }
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $field = 'country_of_manufacture';
     $applyTo = explode(',', $eavSetup->getAttribute(Product::ENTITY, $field, 'apply_to'));
     if (!in_array('grouped', $applyTo)) {
         $applyTo[] = 'grouped';
         $eavSetup->updateAttribute(Product::ENTITY, $field, 'apply_to', implode(',', $applyTo));
     }
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $productTypes = [\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE, \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL, \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE, \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE];
     $productTypes = join(',', $productTypes);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'msrp', ['group' => 'Advanced Pricing', 'backend' => 'Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Price', 'frontend' => '', 'label' => 'Manufacturer\'s Suggested Retail Price', 'type' => 'decimal', 'input' => 'price', 'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_WEBSITE, 'visible' => true, 'required' => false, 'user_defined' => false, 'apply_to' => $productTypes, 'input_renderer' => 'Magento\\Msrp\\Block\\Adminhtml\\Product\\Helper\\Form\\Type', 'frontend_input_renderer' => 'Magento\\Msrp\\Block\\Adminhtml\\Product\\Helper\\Form\\Type', 'visible_on_front' => false, 'used_in_product_listing' => true, 'is_used_in_grid' => true, 'is_visible_in_grid' => false, 'is_filterable_in_grid' => true]);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'msrp_display_actual_price_type', ['group' => 'Advanced Pricing', 'backend' => 'Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Boolean', 'frontend' => '', 'label' => 'Display Actual Price', 'input' => 'select', 'source' => 'Magento\\Msrp\\Model\\Product\\Attribute\\Source\\Type\\Price', 'source_model' => 'Magento\\Msrp\\Model\\Product\\Attribute\\Source\\Type\\Price', 'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_WEBSITE, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::TYPE_USE_CONFIG, 'default_value' => \Magento\Msrp\Model\Product\Attribute\Source\Type\Price::TYPE_USE_CONFIG, 'apply_to' => $productTypes, 'input_renderer' => 'Magento\\Msrp\\Block\\Adminhtml\\Product\\Helper\\Form\\Type\\Price', 'frontend_input_renderer' => 'Magento\\Msrp\\Block\\Adminhtml\\Product\\Helper\\Form\\Type\\Price', 'visible_on_front' => false, 'used_in_product_listing' => true]);
 }
Пример #4
0
 /**
  * Install new Swatch entity
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  * @param ModuleDataSetupInterface $setup
  * @param ModuleContextInterface $context
  * @return void
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     /**
      * Install eav entity types to the eav/entity_type table
      */
     $eavSetup->addAttribute('catalog_product', 'swatch_image', ['type' => 'varchar', 'label' => 'Swatch Image', 'input' => 'media_image', 'frontend' => 'Magento\\Catalog\\Model\\Product\\Attribute\\Frontend\\Image', 'required' => false, 'sort_order' => 3, 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'used_in_product_listing' => true]);
 }
Пример #5
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     /**
      * Add attributes to the eav/attribute
      */
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'test_attribute', ['type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Test Attribute', 'input' => '', 'class' => '', 'source' => '', 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => 0, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'used_in_product_listing' => true, 'unique' => false, 'apply_to' => '']);
 }
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     /**
      * Add attributes to the eav/attribute
      */
     $eavSetup->addAttribute(\Magento\Catalog\Model\Category::ENTITY, 'navigation_position', ['group' => 'General Information', 'type' => 'int', 'label' => 'Navigation Position', 'input' => 'select', 'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL, 'source' => 'SteveB27\\DualCategoryNavigation\\Model\\Entity\\Attribute\\Source\\NavigationPosition', 'sort_order' => 11, 'visible' => true, 'required' => false, 'user_defined' => true, 'default' => '']);
 }
Пример #7
0
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     /**
      * Add attributes to the eav/attribute
      */
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'countdown_enabled', ['group' => 'General', 'type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Show Countdown', 'input' => 'boolean', 'class' => '', 'source' => '', 'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_defined' => true, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'used_in_product_listing' => true, 'unique' => false, 'apply_to' => 'simple,configurable,virtual,bundle,downloadable']);
 }
Пример #8
0
 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Category::ENTITY, 'url_key', ['type' => 'varchar', 'label' => 'URL Key', 'input' => 'text', 'required' => false, 'sort_order' => 3, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, 'group' => 'General Information']);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Category::ENTITY, 'url_path', ['type' => 'varchar', 'required' => false, 'sort_order' => 17, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, 'visible' => false, 'group' => 'General Information']);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'url_key', ['type' => 'varchar', 'label' => 'URL Key', 'input' => 'text', 'required' => false, 'sort_order' => 10, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, 'used_in_product_listing' => true, 'group' => 'Search Engine Optimization']);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'url_path', ['type' => 'varchar', 'required' => false, 'sort_order' => 11, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, 'visible' => false]);
 }
Пример #9
0
 /**
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  *
  * Installs Data for the module :
  *  - Create attribute on category to enable/disable name indexation for search
  *  - Update is anchor attribute (hidden frontend input, null source model, enabled by default).
  *
  * @param ModuleDataSetupInterface $setup   The setup interface
  * @param ModuleContextInterface   $context The module Context
  *
  * @return void
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $this->eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $this->addCategoryNameSearchAttribute();
     $this->updateCategoryIsAnchorAttribute();
     $this->updateDefaultValuesForNameAttributes();
     $this->getIndexer('elasticsuite_categories_fulltext')->reindexAll();
     $setup->endSetup();
 }
Пример #10
0
 /**
  * Sets used_in_recommender for relevant attributes
  *
  * @param ModuleDataSetupInterface $setup
  * @param ModuleContextInterface $context
  * @return void
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);
     $setup->startSetup();
     foreach ($this->_helper->getSystemAttributesToUseInRecommender() as $code) {
         $eavSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, $code, 'used_in_recommender', true);
     }
     $setup->endSetup();
 }
Пример #11
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         /** @var \Magento\Eav\Setup\EavSetup $eavSetup */
         $eavSetup = $this->eavSetupFactory->create();
         $groupId = (int) $eavSetup->getAttributeGroupByCode(Product::ENTITY, 'Default', 'image-management', 'attribute_group_id');
         $eavSetup->addAttributeToGroup(Product::ENTITY, 'Default', $groupId, 'swatch_image');
     }
     $setup->endSetup();
 }
Пример #12
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var CustomerSetup $customerSetup */
     $customerSetup = $this->localizeSetupFactory->create(['setup' => $setup]);
     $setup->startSetup();
     $attributes = ['firstnamekana' => ['type' => 'varchar', 'input' => 'text', 'visible' => true, 'required' => false, 'system' => 0, 'sort_order' => 45, 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', 'position' => 45, 'label' => 'First name kana'], 'lastnamekana' => ['type' => 'varchar', 'input' => 'text', 'visible' => true, 'required' => false, 'system' => 0, 'sort_order' => 65, 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', 'position' => 65, 'label' => 'Last name kana']];
     foreach ($attributes as $code => $options) {
         $customerSetup->addAttribute(Customer::ENTITY, $code, $options);
         $customerSetup->addAttribute('customer_address', $code, $options);
     }
     $this->installCustomerForms($customerSetup, $attributes);
     $setup->endSetup();
 }
Пример #13
0
 /**
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  *
  * Append virtual category related attributes  :
  * - is_virtual_category
  * - virtual_rule
  *
  * @param ModuleDataSetupInterface $setup   The setup interface
  * @param ModuleContextInterface   $context The module Context
  *
  * @return void
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $eavSetup->addAttribute(Category::ENTITY, 'is_virtual_category', ['type' => 'int', 'label' => 'Is virtual category', 'input' => null, 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'required' => false, 'default' => 0, 'visible' => true, 'note' => "Is the category is virtual or not ?", 'sort_order' => 200, 'group' => 'General Information']);
     $eavSetup->addAttribute(Category::ENTITY, 'virtual_category_root', ['type' => 'int', 'label' => 'Virtual category root', 'input' => null, 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'required' => false, 'default' => 0, 'visible' => true, 'note' => "Root display of the virtual category (usefull to display a facet category on virtual).", 'sort_order' => 200, 'group' => 'General Information']);
     $eavSetup->addAttribute(Category::ENTITY, 'virtual_rule', ['type' => 'text', 'label' => 'Virtual rule', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'backend' => 'Smile\\ElasticsuiteVirtualCategory\\Model\\Category\\Attribute\\Backend\\VirtualRule', 'required' => false, 'default' => null, 'visible' => true, 'note' => "Virtual category rule.", 'sort_order' => 210, 'group' => 'General Information']);
     // Force the frontend input to be null for these attributes since they are managed by code.
     $eavSetup->updateAttribute(Category::ENTITY, 'is_virtual_category', 'frontend_input', null);
     $eavSetup->updateAttribute(Category::ENTITY, 'virtual_category_root', 'frontend_input', null);
     $eavSetup->updateAttribute(Category::ENTITY, 'virtual_rule', 'frontend_input', null);
     $setup->endSetup();
 }
Пример #14
0
 /**
  * Upgrade the module data.
  *
  * @param ModuleDataSetupInterface $setup   The setup interface
  * @param ModuleContextInterface   $context The module Context
  *
  * @return void
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $this->eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     if (version_compare($context->getVersion(), '1.2.0', '<')) {
         $this->updateCategorySearchableAttributes();
     }
     if (version_compare($context->getVersion(), '1.2.1', '<')) {
         $productImageAttributeId = $this->eavSetup->getAttributeId(\Magento\Catalog\Model\Product::ENTITY, 'image');
         $setup->getConnection()->update($setup->getTable('catalog_eav_attribute'), ['is_searchable' => 1], $setup->getConnection()->quoteInto('attribute_id = ?', $productImageAttributeId));
     }
     $setup->endSetup();
 }
Пример #15
0
 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $attributes = ['country_of_manufacture', 'minimal_price', 'msrp', 'msrp_display_actual_price_type', 'price', 'special_price', 'special_from_date', 'special_to_date', 'tier_price', 'weight', 'color'];
     foreach ($attributes as $attributeCode) {
         $relatedProductTypes = explode(',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to'));
         if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
             $relatedProductTypes[] = Configurable::TYPE_CODE;
             $eavSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to', implode(',', $relatedProductTypes));
         }
     }
 }
Пример #16
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.2', '<')) {
         /** @var \Magento\Eav\Setup\EavSetup $eavSetup */
         $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
         $eavSetup->addAttributeGroup(ProductAttributeInterface::ENTITY_TYPE_CODE, 'Default', 'Bundle Items', 16);
         $this->upgradePriceType($eavSetup);
         $this->upgradeSkuType($eavSetup);
         $this->upgradeWeightType($eavSetup);
         $this->upgradeShipmentType($eavSetup);
     }
     $setup->endSetup();
 }
Пример #17
0
 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->getConnection()->insertForce($setup->getTable('cataloginventory_stock'), ['stock_id' => 1, 'stock_name' => 'Default']);
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $groupName = 'Product Details';
     $entityTypeId = $eavSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
     $attributeSetId = $eavSetup->getAttributeSetId($entityTypeId, 'Default');
     $attribute = $eavSetup->getAttribute($entityTypeId, 'quantity_and_stock_status');
     if ($attribute) {
         $eavSetup->addAttributeToGroup($entityTypeId, $attributeSetId, $groupName, $attribute['attribute_id'], 60);
         $eavSetup->updateAttribute($entityTypeId, $attribute['attribute_id'], 'default_value', 1);
     }
 }
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         /** @var EavSetup $eavSetup */
         $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
         $field = 'weight';
         $applyTo = explode(',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to'));
         if ($key = array_search('downloadable', $applyTo)) {
             unset($applyTo[$key]);
             $eavSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to', implode(',', $applyTo));
         }
     }
     $setup->endSetup();
 }
Пример #19
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     if (version_compare($context->getVersion(), '0.8.4', '<')) {
         /** @var EavSetup $eavSetup */
         $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
         $fieldList = ['price', 'special_price', 'special_from_date', 'special_to_date', 'minimal_price', 'cost', 'tier_price', 'weight'];
         // make these attributes applicable to demo product
         foreach ($fieldList as $field) {
             $applyTo = explode(',', $eavSetup->getAttribute(Product::ENTITY, $field, 'apply_to'));
             if (!in_array('demo', $applyTo)) {
                 $applyTo[] = 'demo';
                 $eavSetup->updateAttribute(Product::ENTITY, $field, 'apply_to', implode(',', $applyTo));
             }
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.2', '<')) {
         /** @var \Magento\Eav\Setup\EavSetup $eavSetup */
         $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
         $eavSetup->updateAttribute(Product::ENTITY, 'price_type', 'frontend_input', 'boolean');
         $eavSetup->updateAttribute(Product::ENTITY, 'price_type', 'source_model', 'Magento\\Bundle\\Model\\Product\\Attribute\\Source\\Price\\Type');
         $eavSetup->updateAttribute(Product::ENTITY, 'sku_type', 'frontend_input', 'boolean');
         $eavSetup->updateAttribute(Product::ENTITY, 'sku_type', 'source_model', 'Magento\\Bundle\\Model\\Product\\Attribute\\Source\\Price\\Type');
         $eavSetup->updateAttribute(Product::ENTITY, 'weight_type', 'frontend_input', 'boolean');
         $eavSetup->updateAttribute(Product::ENTITY, 'weight_type', 'source_model', 'Magento\\Bundle\\Model\\Product\\Attribute\\Source\\Price\\Type');
         $eavSetup->updateAttribute(Product::ENTITY, 'shipment_type', 'frontend_input', 'select');
         $eavSetup->updateAttribute(Product::ENTITY, 'shipment_type', 'frontend_label', __('Ship Bundle Items'), 1);
         $eavSetup->updateAttribute(Product::ENTITY, 'shipment_type', 'source_model', 'Magento\\Bundle\\Model\\Product\\Attribute\\Source\\Shipment\\Type');
     }
     $setup->endSetup();
 }
Пример #21
0
 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $varcharOptions = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'visible' => true, 'required' => false];
     $booleanOptions = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, 'visible' => true, 'required' => false];
     /** @var \Magento\Quote\Setup\QuoteSetup $quoteSetup */
     $quoteSetup = $this->_quoteSetupFactory->create(['setup' => $setup]);
     $quoteSetup->addAttribute('quote', 'vatpername', $varcharOptions);
     $quoteSetup->addAttribute('quote', 'vatcomment', $varcharOptions);
     $quoteSetup->addAttribute('quote', 'vatdeclare', $booleanOptions);
     $quoteSetup->addAttribute('quote_item', 'vat_exempt', $booleanOptions);
     /** @var \Magento\Sales\Setup\SalesSetup $salesSetup */
     $salesSetup = $this->_salesSetupFactory->create(['setup' => $setup]);
     $salesSetup->addAttribute('order', 'vatpername', $varcharOptions);
     $salesSetup->addAttribute('order', 'vatcomment', $varcharOptions);
     $salesSetup->addAttribute('order', 'vatdeclare', $booleanOptions);
     $salesSetup->addAttribute('order_item', 'vat_exempt', $booleanOptions);
     /** @var Magento\Eav\Setup\EavSetupFactory $eavSetup */
     $eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'vat_exempt', ['group' => 'General', 'type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Vat Exempt', 'input' => 'select', 'class' => '', 'source' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Boolean', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => true, 'required' => false, 'user_defined' => true, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => true, 'unique' => false, 'apply_to' => 'simple,configurable,virtual', 'is_configurable' => false]);
 }
Пример #22
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     /**
      * Add attributes to the eav/attribute table
      */
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'links_purchased_separately', ['type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Links can be purchased separately', 'input' => '', 'class' => '', 'source' => '', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'visible' => false, 'required' => true, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'unique' => false, 'apply_to' => 'downloadable', 'used_in_product_listing' => true]);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'samples_title', ['type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => 'Samples title', 'input' => '', 'class' => '', 'source' => '', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => false, 'required' => true, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'unique' => false, 'apply_to' => 'downloadable']);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'links_title', ['type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => 'Links title', 'input' => '', 'class' => '', 'source' => '', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE, 'visible' => false, 'required' => true, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'unique' => false, 'apply_to' => 'downloadable']);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'links_exist', ['type' => 'int', 'backend' => '', 'frontend' => '', 'label' => '', 'input' => '', 'class' => '', 'source' => '', 'global' => true, 'visible' => false, 'required' => false, 'user_defined' => false, 'default' => '0', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'unique' => false, 'apply_to' => 'downloadable', 'used_in_product_listing' => 1]);
     $fieldList = ['price', 'special_price', 'special_from_date', 'special_to_date', 'minimal_price', 'cost', 'tier_price', 'weight'];
     // make these attributes applicable to downloadable products
     foreach ($fieldList as $field) {
         $applyTo = explode(',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to'));
         if (!in_array('downloadable', $applyTo)) {
             $applyTo[] = 'downloadable';
             $eavSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to', implode(',', $applyTo));
         }
     }
 }
Пример #23
0
 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     /** @var \Magento\Framework\Module\Setup\Migration $migrationSetup */
     $migrationSetup = $setup->createMigrationSetup();
     $migrationSetup->appendClassAliasReplace('eav_attribute', 'attribute_model', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, ['attribute_id']);
     $migrationSetup->appendClassAliasReplace('eav_attribute', 'backend_model', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, ['attribute_id']);
     $migrationSetup->appendClassAliasReplace('eav_attribute', 'frontend_model', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, ['attribute_id']);
     $migrationSetup->appendClassAliasReplace('eav_attribute', 'source_model', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, ['attribute_id']);
     $migrationSetup->appendClassAliasReplace('eav_entity_type', 'entity_model', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, ['entity_type_id']);
     $migrationSetup->appendClassAliasReplace('eav_entity_type', 'attribute_model', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, ['entity_type_id']);
     $migrationSetup->appendClassAliasReplace('eav_entity_type', 'increment_model', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, ['entity_type_id']);
     $migrationSetup->appendClassAliasReplace('eav_entity_type', 'entity_attribute_collection', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_RESOURCE, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, ['entity_type_id']);
     $migrationSetup->doUpdateClassAliases();
     /** @var \Magento\Eav\Setup\EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $groups = $eavSetup->getAttributeGroupCollectionFactory();
     foreach ($groups as $group) {
         /** @var $group \Magento\Eav\Model\Entity\Attribute\Group*/
         $group->save();
     }
     $setup->endSetup();
 }
Пример #24
0
 /**
  * Migration from 1.0.0 to 1.1.0 :
  *   - Updating the attribute virtual_category_root from type varchar to type int
  *   - Updating the value of the attribute from 'category/13' to '13.
  *
  * @param ModuleDataSetupInterface $setup Setup.
  *
  * @return $this
  */
 private function updateVirtualCategoryRootTypeToInt(ModuleDataSetupInterface $setup)
 {
     /**
      * @var \Magento\Eav\Setup\EavSetup $eavSetup
      */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     // Fix the attribute type.
     $eavSetup->updateAttribute(Category::ENTITY, 'virtual_category_root', 'backend_type', 'int');
     // Retrieve information about the attribute and storage config.
     $virtualRootAttributeId = $eavSetup->getAttribute(Category::ENTITY, 'virtual_category_root', 'attribute_id');
     $originalTable = $setup->getTable('catalog_category_entity_varchar');
     $targetTable = $setup->getTable('catalog_category_entity_int');
     $baseFields = array_slice(array_keys($setup->getConnection()->describeTable($originalTable)), 1, -1);
     // Select old value.
     $valueSelect = $setup->getConnection()->select();
     $valueSelect->from($setup->getTable('catalog_category_entity_varchar'), $baseFields)->where('attribute_id = ?', $virtualRootAttributeId)->columns(['value' => new \Zend_Db_Expr('REPLACE(value, "category/", "")')]);
     // Insert old values into the new table.
     $query = $setup->getConnection()->insertFromSelect($valueSelect, $targetTable, array_merge($baseFields, ['value']), AdapterInterface::INSERT_IGNORE);
     $setup->getConnection()->query($query);
     // Delete old value.
     $setup->getConnection()->delete($originalTable, "attribute_id = {$virtualRootAttributeId}");
     return $this;
 }
Пример #25
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $fieldList = ['price', 'special_price', 'special_from_date', 'special_to_date', 'minimal_price', 'cost', 'tier_price', 'weight'];
     foreach ($fieldList as $field) {
         $applyTo = explode(',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to'));
         if (!in_array('bundle', $applyTo)) {
             $applyTo[] = 'bundle';
             $eavSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to', implode(',', $applyTo));
         }
     }
     $applyTo = explode(',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'cost', 'apply_to'));
     unset($applyTo[array_search('bundle', $applyTo)]);
     $eavSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, 'cost', 'apply_to', implode(',', $applyTo));
     /**
      * Add attributes to the eav/attribute
      */
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'price_type', ['type' => 'int', 'backend' => '', 'frontend' => '', 'label' => '', 'input' => '', 'class' => '', 'source' => '', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'used_in_product_listing' => true, 'unique' => false, 'apply_to' => 'bundle']);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'sku_type', ['type' => 'int', 'backend' => '', 'frontend' => '', 'label' => '', 'input' => '', 'class' => '', 'source' => '', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'visible' => false, 'required' => true, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'unique' => false, 'apply_to' => 'bundle']);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'weight_type', ['type' => 'int', 'backend' => '', 'frontend' => '', 'label' => '', 'input' => '', 'class' => '', 'source' => '', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'visible' => false, 'required' => true, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'used_in_product_listing' => true, 'unique' => false, 'apply_to' => 'bundle']);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'price_view', ['group' => 'Advanced Pricing', 'type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Price View', 'input' => 'select', 'class' => '', 'source' => 'Magento\\Bundle\\Model\\Product\\Attribute\\Source\\Price\\View', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'used_in_product_listing' => true, 'unique' => false, 'apply_to' => 'bundle']);
     $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'shipment_type', ['type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Shipment', 'input' => '', 'class' => '', 'source' => '', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'visible' => false, 'required' => true, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'used_in_product_listing' => true, 'unique' => false, 'apply_to' => 'bundle']);
 }
Пример #26
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();
 }
Пример #27
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $setup->startSetup();
     $connection = $setup->getConnection();
     $select = $connection->select()->from($setup->getTable('core_config_data'), 'COUNT(*)')->where('path=?', 'customer/address/prefix_show')->where('value NOT LIKE ?', '0');
     $showPrefix = (bool) $this->customerAddress->getConfig('prefix_show') || $connection->fetchOne($select) > 0;
     $select = $connection->select()->from($setup->getTable('core_config_data'), 'COUNT(*)')->where('path=?', 'customer/address/middlename_show')->where('value NOT LIKE ?', '0');
     $showMiddlename = (bool) $this->customerAddress->getConfig('middlename_show') || $connection->fetchOne($select) > 0;
     $select = $connection->select()->from($setup->getTable('core_config_data'), 'COUNT(*)')->where('path=?', 'customer/address/suffix_show')->where('value NOT LIKE ?', '0');
     $showSuffix = (bool) $this->customerAddress->getConfig('suffix_show') || $connection->fetchOne($select) > 0;
     $select = $connection->select()->from($setup->getTable('core_config_data'), 'COUNT(*)')->where('path=?', 'customer/address/dob_show')->where('value NOT LIKE ?', '0');
     $showDob = (bool) $this->customerAddress->getConfig('dob_show') || $connection->fetchOne($select) > 0;
     $select = $connection->select()->from($setup->getTable('core_config_data'), 'COUNT(*)')->where('path=?', 'customer/address/taxvat_show')->where('value NOT LIKE ?', '0');
     $showTaxVat = (bool) $this->customerAddress->getConfig('taxvat_show') || $connection->fetchOne($select) > 0;
     $customerEntityTypeId = $eavSetup->getEntityTypeId('customer');
     $addressEntityTypeId = $eavSetup->getEntityTypeId('customer_address');
     /**
      *****************************************************************************
      * checkout/onepage/register
      *****************************************************************************
      */
     $connection->insert($setup->getTable('eav_form_type'), ['code' => 'checkout_onepage_register', 'label' => 'checkout_onepage_register', 'is_system' => 1, 'theme' => '', 'store_id' => 0]);
     $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type'));
     $connection->insert($setup->getTable('eav_form_type_entity'), ['type_id' => $formTypeId, 'entity_type_id' => $customerEntityTypeId]);
     $connection->insert($setup->getTable('eav_form_type_entity'), ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId]);
     $elementSort = 0;
     if ($showPrefix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'), 'sort_order' => $elementSort++]);
     if ($showMiddlename) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'), 'sort_order' => $elementSort++]);
     if ($showSuffix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'email'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'), 'sort_order' => $elementSort++]);
     if ($showDob) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'dob'), 'sort_order' => $elementSort++]);
     }
     if ($showTaxVat) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'taxvat'), 'sort_order' => $elementSort++]);
     }
     /**
      *****************************************************************************
      * checkout/onepage/register_guest
      *****************************************************************************
      */
     $connection->insert($setup->getTable('eav_form_type'), ['code' => 'checkout_onepage_register_guest', 'label' => 'checkout_onepage_register_guest', 'is_system' => 1, 'theme' => '', 'store_id' => 0]);
     $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type'));
     $connection->insert($setup->getTable('eav_form_type_entity'), ['type_id' => $formTypeId, 'entity_type_id' => $customerEntityTypeId]);
     $connection->insert($setup->getTable('eav_form_type_entity'), ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId]);
     $elementSort = 0;
     if ($showPrefix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'), 'sort_order' => $elementSort++]);
     if ($showMiddlename) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'), 'sort_order' => $elementSort++]);
     if ($showSuffix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'email'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'), 'sort_order' => $elementSort++]);
     if ($showDob) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'dob'), 'sort_order' => $elementSort++]);
     }
     if ($showTaxVat) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'taxvat'), 'sort_order' => $elementSort++]);
     }
     /**
      *****************************************************************************
      * checkout/onepage/billing_address
      *****************************************************************************
      */
     $connection->insert($setup->getTable('eav_form_type'), ['code' => 'checkout_onepage_billing_address', 'label' => 'checkout_onepage_billing_address', 'is_system' => 1, 'theme' => '', 'store_id' => 0]);
     $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type'));
     $connection->insert($setup->getTable('eav_form_type_entity'), ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId]);
     $elementSort = 0;
     if ($showPrefix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'), 'sort_order' => $elementSort++]);
     if ($showMiddlename) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'), 'sort_order' => $elementSort++]);
     if ($showSuffix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'), 'sort_order' => $elementSort++]);
     /**
      *****************************************************************************
      * checkout/onepage/shipping_address
      *****************************************************************************
      */
     $connection->insert($setup->getTable('eav_form_type'), ['code' => 'checkout_onepage_shipping_address', 'label' => 'checkout_onepage_shipping_address', 'is_system' => 1, 'theme' => '', 'store_id' => 0]);
     $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type'));
     $connection->insert($setup->getTable('eav_form_type_entity'), ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId]);
     $elementSort = 0;
     if ($showPrefix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'), 'sort_order' => $elementSort++]);
     if ($showMiddlename) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'), 'sort_order' => $elementSort++]);
     if ($showSuffix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'), 'sort_order' => $elementSort++]);
     $table = $setup->getTable('core_config_data');
     $select = $connection->select()->from($table, ['config_id', 'value'])->where('path = ?', 'checkout/options/onepage_checkout_disabled');
     $data = $connection->fetchAll($select);
     if ($data) {
         try {
             $connection->beginTransaction();
             foreach ($data as $value) {
                 $bind = ['path' => 'checkout/options/onepage_checkout_enabled', 'value' => !(bool) $value['value']];
                 $where = 'config_id = ' . $value['config_id'];
                 $connection->update($table, $bind, $where);
             }
             $connection->commit();
         } catch (\Exception $e) {
             $connection->rollback();
             throw $e;
         }
     }
     $setup->endSetup();
 }