public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $this->installer = $setup; $this->installer->startSetup(); try { $this->installGeneral(); $this->installEbay(); $this->installAmazon(); } catch (\Exception $exception) { return; } $this->installer->endSetup(); $this->getConnection()->insert($this->getFullTableName('setup'), ['version_from' => NULL, 'version_to' => $this->getConfigVersion(), 'is_completed' => 1, 'update_date' => $this->helperFactory->getObject('Data')->getCurrentGmtDate(), 'create_date' => $this->helperFactory->getObject('Data')->getCurrentGmtDate()]); $this->helperFactory->getObject('Module\\Maintenance\\Setup')->disable(); }
/** * {@inheritdoc} */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); /* * Report Event Types default data */ $eventTypeData = [['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_VIEW, 'event_name' => 'catalog_product_view'], ['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_SEND, 'event_name' => 'sendfriend_product'], ['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_COMPARE, 'event_name' => 'catalog_product_compare_add_product'], ['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_TO_CART, 'event_name' => 'checkout_cart_add_product'], ['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_TO_WISHLIST, 'event_name' => 'wishlist_add_product'], ['event_type_id' => \Magento\Reports\Model\Event::EVENT_WISHLIST_SHARE, 'event_name' => 'wishlist_share']]; foreach ($eventTypeData as $row) { $setup->getConnection()->insertForce($setup->getTable('report_event_types'), $row); } /** * Prepare database after data upgrade */ $setup->endSetup(); /** * Cms Page with 'home' identifier page modification for report pages */ /** @var $cms \Magento\Cms\Model\Page */ $cms = $this->pageFactory->create(); $cms->load('home', 'identifier'); $reportLayoutUpdate = '<!-- <referenceContainer name="right"> <action method="unsetChild"><argument name="alias" xsi:type="string">right.reports.product.viewed</argument></action> <action method="unsetChild"><argument name="alias" xsi:type="string">right.reports.product.compared</argument></action> </referenceContainer>-->'; /* * Merge and save old layout update data with report layout data */ $cms->setLayoutUpdateXml($cms->getLayoutUpdateXml() . $reportLayoutUpdate)->save(); }
/** * {@inheritdoc} * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var CustomerSetup $customerSetup */ $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]); $setup->startSetup(); // insert default customer groups $setup->getConnection()->insertForce($setup->getTable('customer_group'), ['customer_group_id' => 0, 'customer_group_code' => 'NOT LOGGED IN', 'tax_class_id' => 3]); $setup->getConnection()->insertForce($setup->getTable('customer_group'), ['customer_group_id' => 1, 'customer_group_code' => 'General', 'tax_class_id' => 3]); $setup->getConnection()->insertForce($setup->getTable('customer_group'), ['customer_group_id' => 2, 'customer_group_code' => 'Wholesale', 'tax_class_id' => 3]); $setup->getConnection()->insertForce($setup->getTable('customer_group'), ['customer_group_id' => 3, 'customer_group_code' => 'Retailer', 'tax_class_id' => 3]); $customerSetup->installEntities(); $customerSetup->installCustomerForms(); $disableAGCAttribute = $customerSetup->getEavConfig()->getAttribute('customer', 'disable_auto_group_change'); $disableAGCAttribute->setData('used_in_forms', ['adminhtml_customer']); $disableAGCAttribute->save(); $attributesInfo = ['vat_id' => ['label' => 'VAT number', 'type' => 'static', 'input' => 'text', 'position' => 140, 'visible' => true, 'required' => false], 'vat_is_valid' => ['label' => 'VAT number validity', 'visible' => false, 'required' => false, 'type' => 'static'], 'vat_request_id' => ['label' => 'VAT number validation request ID', 'type' => 'static', 'visible' => false, 'required' => false], 'vat_request_date' => ['label' => 'VAT number validation request date', 'type' => 'static', 'visible' => false, 'required' => false], 'vat_request_success' => ['label' => 'VAT number validation request success', 'visible' => false, 'required' => false, 'type' => 'static']]; foreach ($attributesInfo as $attributeCode => $attributeParams) { $customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams); } $vatIdAttribute = $customerSetup->getEavConfig()->getAttribute('customer_address', 'vat_id'); $vatIdAttribute->setData('used_in_forms', ['adminhtml_customer_address', 'customer_address_edit', 'customer_register_address']); $vatIdAttribute->save(); $entities = $customerSetup->getDefaultEntities(); foreach ($entities as $entityName => $entity) { $customerSetup->addEntityType($entityName, $entity); } $customerSetup->updateAttribute('customer_address', 'street', 'backend_model', 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\DefaultBackend'); $migrationSetup = $setup->createMigrationSetup(); $migrationSetup->appendClassAliasReplace('customer_eav_attribute', 'data_model', Migration::ENTITY_TYPE_MODEL, Migration::FIELD_CONTENT_TYPE_PLAIN, ['attribute_id']); $migrationSetup->doUpdateClassAliases(); $setup->endSetup(); }
/** * {@inheritdoc} */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $roleCollection = $this->authFactory->createRoleCollection()->addFieldToFilter('parent_id', 0)->addFieldToFilter('tree_level', 1)->addFieldToFilter('role_type', RoleGroup::ROLE_TYPE)->addFieldToFilter('user_id', 0)->addFieldToFilter('user_type', UserContextInterface::USER_TYPE_ADMIN)->addFieldToFilter('role_name', 'Administrators'); if ($roleCollection->count() == 0) { $admGroupRole = $this->authFactory->createRole()->setData(['parent_id' => 0, 'tree_level' => 1, 'sort_order' => 1, 'role_type' => RoleGroup::ROLE_TYPE, 'user_id' => 0, 'user_type' => UserContextInterface::USER_TYPE_ADMIN, 'role_name' => 'Administrators'])->save(); } else { foreach ($roleCollection as $item) { $admGroupRole = $item; break; } } $rulesCollection = $this->authFactory->createRulesCollection()->addFieldToFilter('role_id', $admGroupRole->getId())->addFieldToFilter('resource_id', 'all'); if ($rulesCollection->count() == 0) { $this->authFactory->createRules()->setData(['role_id' => $admGroupRole->getId(), 'resource_id' => 'Magento_Backend::all', 'privileges' => null, 'permission' => 'allow'])->save(); } else { /** @var \Magento\Authorization\Model\Rules $rule */ foreach ($rulesCollection as $rule) { $rule->setData('resource_id', 'Magento_Backend::all')->save(); } } /** * Delete rows by condition from authorization_rule */ $setup->startSetup(); $tableName = $setup->getTable('authorization_rule'); if ($tableName) { $setup->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']); } $setup->endSetup(); }
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); $salesDepartment = $this->departmentFactory->create(); $salesDepartment->setName('Sales'); $salesDepartment->save(); $employee = $this->employeeFactory->create(); $employee->setDepartmentId($salesDepartment->getId()); $employee->setEmail('*****@*****.**'); $employee->setFirstName('John'); $employee->setLastName('Doe'); $employee->setServiceYears(3); $employee->setDob('1983-03-28'); $employee->setSalary(3800.0); $employee->setVatNumber('GB123456789'); $employee->setNote('Just some notes about John'); $employee->save(); $financeDepartment = $this->departmentFactory->create(); $financeDepartment->setName('Finance'); $financeDepartment->save(); $employee = $this->employeeFactory->create(); $employee->setDepartmentId($financeDepartment->getId()); $employee->setEmail('*****@*****.**'); $employee->setFirstName('Anna'); $employee->setLastName('Doe'); $employee->setServiceYears(5); $employee->setDob('1986-08-16'); $employee->setSalary(4200.0); $employee->setVatNumber('GB223344556'); $employee->setNote('Just some notes about Anna'); $employee->save(); $setup->endSetup(); }
/** * {@inheritdoc} * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); /** @var CustomerSetup $customerSetup */ $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]); if (version_compare($context->getVersion(), '2.0.1', '<')) { $entityAttributes = ['customer' => ['website_id' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => false], 'created_in' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => false, 'is_searchable_in_grid' => true], 'email' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => true], 'group_id' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => false], 'dob' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => false], 'taxvat' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => false, 'is_searchable_in_grid' => true], 'confirmation' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => false], 'created_at' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => false], 'gender' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => false]], 'customer_address' => ['company' => ['is_used_in_grid' => true, 'is_visible_in_grid' => false, 'is_filterable_in_grid' => false, 'is_searchable_in_grid' => true], 'street' => ['is_used_in_grid' => true, 'is_visible_in_grid' => false, 'is_filterable_in_grid' => false, 'is_searchable_in_grid' => true], 'city' => ['is_used_in_grid' => true, 'is_visible_in_grid' => false, 'is_filterable_in_grid' => false, 'is_searchable_in_grid' => true], 'country_id' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => false], 'region' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => false, 'is_searchable_in_grid' => true], 'region_id' => ['is_used_in_grid' => true, 'is_visible_in_grid' => false, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => false], 'postcode' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => true], 'telephone' => ['is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => true], 'fax' => ['is_used_in_grid' => true, 'is_visible_in_grid' => false, 'is_filterable_in_grid' => false, 'is_searchable_in_grid' => true]]]; $this->upgradeAttributes($entityAttributes, $customerSetup); } if (version_compare($context->getVersion(), '2.0.2') < 0) { $entityTypeId = $customerSetup->getEntityTypeId(Customer::ENTITY); $attributeId = $customerSetup->getAttributeId($entityTypeId, 'gender'); $option = ['attribute_id' => $attributeId, 'values' => [3 => 'Not Specified']]; $customerSetup->addAttributeOption($option); } if (version_compare($context->getVersion(), '2.0.3', '<')) { $entityAttributes = ['customer_address' => ['region_id' => ['is_used_in_grid' => false, 'is_visible_in_grid' => false, 'is_filterable_in_grid' => false, 'is_searchable_in_grid' => false], 'firstname' => ['is_used_in_grid' => true, 'is_visible_in_grid' => false, 'is_filterable_in_grid' => false, 'is_searchable_in_grid' => true], 'lastname' => ['is_used_in_grid' => true, 'is_visible_in_grid' => false, 'is_filterable_in_grid' => false, 'is_searchable_in_grid' => true]]]; $this->upgradeAttributes($entityAttributes, $customerSetup); } if (version_compare($context->getVersion(), '2.0.4', '<')) { $customerSetup->addAttribute(Customer::ENTITY, 'updated_at', ['type' => 'static', 'label' => 'Updated At', 'input' => 'date', 'required' => false, 'sort_order' => 87, 'visible' => false, 'system' => false]); } if (version_compare($context->getVersion(), '2.0.5', '<')) { $this->upgradeHash($setup); $entityAttributes = ['customer_address' => ['fax' => ['is_visible' => false, 'is_system' => false]]]; $this->upgradeAttributes($entityAttributes, $customerSetup); } $indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID); $indexer->reindexAll(); $this->eavConfig->clear(); $setup->endSetup(); }
/** * {@inheritdoc} */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** * Prepare database for install */ $setup->startSetup(); $quoteInstaller = $this->quoteSetupFactory->create(['resourceName' => 'quote_setup', 'setup' => $setup]); $salesInstaller = $this->salesSetupFactory->create(['resourceName' => 'sales_setup', 'setup' => $setup]); /** * Add paypal attributes to the: * - sales/flat_quote_payment_item table * - sales/flat_order table */ $quoteInstaller->addAttribute('quote_payment', 'paypal_payer_id', []); $quoteInstaller->addAttribute('quote_payment', 'paypal_payer_status', []); $quoteInstaller->addAttribute('quote_payment', 'paypal_correlation_id', []); $salesInstaller->addAttribute('order', 'paypal_ipn_customer_notified', ['type' => 'int', 'visible' => false, 'default' => 0]); $data = []; $statuses = ['pending_paypal' => __('Pending PayPal'), 'paypal_reversed' => __('PayPal Reversed'), 'paypal_canceled_reversal' => __('PayPal Canceled Reversal')]; foreach ($statuses as $code => $info) { $data[] = ['status' => $code, 'label' => $info]; } $setup->getConnection()->insertArray($setup->getTable('sales_order_status'), ['status', 'label'], $data); /** * Prepare database after install */ $setup->endSetup(); }
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); $helloText = $this->_helloTextFactory->create(); $helloText->setData('product', 14)->setText('Das ist nur ein Test')->save(); $setup->endSetup(); }
/** * {@inheritdoc} */ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); $indexer = $this->indexerRegistry->get(Config::DESIGN_CONFIG_GRID_INDEXER_ID); $indexer->reindexAll(); $setup->endSetup(); }
/** * {@inheritdoc} * @SuppressWarnings(PHPMD.NPathComplexity) */ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); /** @var CustomerSetup $customerSetup */ $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]); if (version_compare($context->getVersion(), '2.0.6', '<')) { $this->upgradeVersionTwoZeroSix($customerSetup); } if (version_compare($context->getVersion(), '2.0.1', '<')) { $this->upgradeVersionTwoZeroOne($customerSetup); } if (version_compare($context->getVersion(), '2.0.2') < 0) { $this->upgradeVersionTwoZeroTwo($customerSetup); } if (version_compare($context->getVersion(), '2.0.3', '<')) { $this->upgradeVersionTwoZeroThree($customerSetup); } if (version_compare($context->getVersion(), '2.0.4', '<')) { $this->upgradeVersionTwoZeroFour($customerSetup); } if (version_compare($context->getVersion(), '2.0.5', '<')) { $this->upgradeVersionTwoZeroFive($customerSetup, $setup); } if (version_compare($context->getVersion(), '2.0.6', '<')) { $setup->getConnection()->delete($setup->getTable('customer_form_attribute'), ['form_code = ?' => 'checkout_register']); } if (version_compare($context->getVersion(), '2.0.7', '<')) { $this->upgradeVersionTwoZeroSeven($customerSetup); $this->upgradeCustomerPasswordResetlinkExpirationPeriodConfig($setup); } $indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID); $indexer->reindexAll(); $this->eavConfig->clear(); $setup->endSetup(); }
/** * {@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(); }
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '2.0.1', '<')) { /** * install vat exempt tax class */ $data = [['class_name' => 'Vatexempt Class', 'class_type' => \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_PRODUCT]]; foreach ($data as $row) { $setup->getConnection()->insertForce($setup->getTable('tax_class'), $row); } /** * install vat exempt tax rate */ $data = [['tax_country_id' => 'US', 'tax_region_id' => '*', 'tax_postcode' => '*', 'code' => 'Vat Exempt', 'rate' => '0.00']]; foreach ($data as $row) { $setup->getConnection()->insertForce($setup->getTable('tax_calculation_rate'), $row); } /** * install vat exempt tax rule */ $this->_executor->exec($this->_installer); } $setup->endSetup(); }
/** * {@inheritdoc} */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** * Prepare database for install */ $setup->startSetup(); /** * PagSeguro Order Status */ $statuses = ['pagseguro_iniciado' => __('PagSeguro Iniciado'), 'pagseguro_aguardando_pagamento' => __('PagSeguro Aguardando Pagamento'), 'pagseguro_cancelada' => __('PagSeguro Cancelada'), 'pagseguro_chargeback_debitado' => __('PagSeguro Chargeback Debitado'), 'pagseguro_devolvida' => __('PagSeguro Devolvida'), 'pagseguro_disponivel' => __('PagSeguro Disponível'), 'pagseguro_em_analise' => __('PagSeguro Em Análise'), 'pagseguro_em_contestacao' => __('PagSeguro Em Contestação'), 'pagseguro_em_disputa' => __('PagSeguro Em Disputa'), 'pagseguro_paga' => __('PagSeguro Paga')]; foreach ($statuses as $code => $info) { $status[] = ['status' => $code, 'label' => $info]; $state[] = ['status' => $code, 'state' => 'new', 'is_default' => 0, 'visible_on_front' => '1']; } $setup->getConnection()->insertArray($setup->getTable('sales_order_status'), ['status', 'label'], $status); /** * PagSeguro Order State */ $state[0]['is_default'] = 1; $setup->getConnection()->insertArray($setup->getTable('sales_order_status_state'), ['status', 'state', 'is_default', 'visible_on_front'], $state); unset($data); /** * PagSeguro Store Reference */ $data[] = ['scope' => 'default', 'scope_id' => 0, 'path' => 'pagseguro/store/reference', 'value' => \UOL\PagSeguro\Helper\Data::generateStoreReference()]; $setup->getConnection()->insertArray($setup->getTable('core_config_data'), ['scope', 'scope_id', 'path', 'value'], $data); /** * Prepare database after install */ $setup->endSetup(); }
/** * {@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(); }
/** * {@inheritdoc} */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); $setup->startSetup(); $installer->appendClassAliasReplace('core_config_data', 'value', Migration::ENTITY_TYPE_MODEL, Migration::FIELD_CONTENT_TYPE_PLAIN, ['config_id']); $installer->doUpdateClassAliases(); $setup->endSetup(); }
/** * 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(); if (version_compare($context->getVersion(), '1.1.0', '<')) { $this->updateVirtualCategoryRootTypeToInt($setup); } $setup->endSetup(); }
/** * @inheritdoc */ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '2.0.1', '<')) { $this->upgradeHash($setup); } $setup->endSetup(); }
/** * @inheritdoc */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $this->_context = $context; $setup->startSetup(); /* perform module specific operations */ $this->_setup(); $setup->endSetup(); }
/** * Installs DB schema for a module * * @param ModuleDataSetupInterface $setup * @param ModuleContextInterface $context * @return void */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); /** @var CustomerSetup $customerSetup */ $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]); $customerSetup->addAttribute(Customer::ENTITY, 'client_idn', ['label' => 'Client IDN', 'input' => 'text', 'required' => false, 'sort_order' => 40, 'visible' => true, 'system' => false, 'is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => true, 'used_in_forms', ['adminhtml_customer']]); $setup->endSetup(); }
/** * {@inheritdoc} */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); $setup->startSetup(); $installer->appendClassAliasReplace('salesrule', 'conditions_serialized', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, ['rule_id']); $installer->appendClassAliasReplace('salesrule', 'actions_serialized', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, ['rule_id']); $installer->doUpdateClassAliases(); $setup->endSetup(); }
/** * {@inheritdoc} */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup->createMigrationSetup(); $setup->startSetup(); $installer->appendClassAliasReplace('widget_instance', 'instance_type', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, ['instance_id']); $installer->appendClassAliasReplace('layout_update', 'xml', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, ['layout_update_id']); $installer->doUpdateClassAliases(); $setup->endSetup(); }
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $setup->startSetup(); $connection = $installer->getConnection(); $select = $connection->select(); $select->from(['catalog_eav_attribute' => $installer->getTable('catalog_eav_attribute')], ['attribute_id', 'store_id' => new \Zend_Db_Expr(0)]); $connection->query($connection->insertFromSelect($select, $installer->getTable('genmato_multistoresearchfields_attribute_search_store'), ['attribute_id', 'store_id'])); $setup->endSetup(); }
/** * 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(); }
/** * {@inheritdoc} */ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '2.0.1', '<')) { $connection = $setup->getConnection(); $select = $connection->select()->from($this->relationProcessor->getTable('catalog_product_link'), ['product_id', 'linked_product_id'])->where('link_type_id = ?', Link::LINK_TYPE_GROUPED); $connection->query($connection->insertFromSelect($select, $this->relationProcessor->getMainTable(), ['parent_id', 'child_id'], AdapterInterface::INSERT_IGNORE)); } $setup->endSetup(); }
/** * @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(); }
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '2.0.1') < 0) { /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); $entityTypeId = $eavSetup->getEntityTypeId(Product::ENTITY); $eavSetup->addAttribute($entityTypeId, 'sample', ['type' => 'varchar', 'label' => 'Sample', 'input' => 'multiselect', 'global' => ScopedAttributeInterface::SCOPE_STORE, 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend', 'group' => 'Sample Group', 'visible_on_front' => 1, 'option' => ['values' => [0 => 'Sample Option One', 1 => 'Sample Option Two']]]); } $setup->endSetup(); }
/** * {@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(); }
/** * {@inheritdoc} * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); $data = ['title' => 'title', 'link' => 'link', 'status' => 'status', 'image_link' => 'image_link', 'thumbnail_label' => 'thumbnail_label', 'rating' => 'rating', 'short_description' => 'short_description', 'mag_id' => 'mag_id', 'visible' => 'visible', 'store_id' => 'store_id', 'is_in_stock' => 'is_in_stock', 'sku' => 'sku', 'category' => 'category', 'websites' => 'websites', 'news_from_date' => 'news_from_date', 'news_to_date' => 'news_to_date']; $id = 1; foreach ($data as $xml_field => $code_field) { $setup->getConnection()->insertForce($setup->getTable('celebros_mapping'), ['id' => $id, 'xml_field' => $xml_field, 'code_field' => $code_field]); $id++; } $setup->endSetup(); }
/** * {@inheritdoc} */ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { /** @var TaxSetup $taxSetup */ $taxSetup = $this->taxSetupFactory->create(['resourceName' => 'tax_setup', 'setup' => $setup]); $setup->startSetup(); if (version_compare($context->getVersion(), '2.0.1', '<')) { //Update the tax_class_id attribute in the 'catalog_eav_attribute' table $taxSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, 'tax_class_id', 'is_visible_in_advanced_search', false); } $setup->endSetup(); }
/** * {@inheritdoc} */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); $postSetup = $this->postSetupFactory->create(['setup' => $setup]); $postSetup->installEntities(); $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]); $categorySetup->installEntities(); $setup->endSetup(); $this->eavConfig->clear(); $category = $categorySetup->getCategoryFactory()->create(); $category->setName(__('Blog'))->setParentId(null)->setPath('1')->setLevel(0)->setPosition(0)->setStatus(1)->save(); }