Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
- $attributeSet = $this->attributeSetFactory->create();
- $entityTypeId = $categorySetup->getEntityTypeId(MagentoCatalogModelProduct::ENTITY);
- $attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId, 'medicamento_expira_curta2');
- $autosettingsTabName = 'medicamento_expira_curta2_group';
- $categorySetup->addAttributeGroup($entityTypeId, $attributeSetId, $autosettingsTabName, 60);
- $data = [
- 'attribute_set_name' => 'medicamento_expira_curta2',
- 'entity_type_id' => $entityTypeId,
- 'sort_order' => 200,
- ];
- $attributeSet->setData($data);
- $attributeSet->validate();
- $attributeSet->save();
- $attributeSet->initFromSkeleton($attributeSetId);
- $attributeSet->save();
- $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
- $eavSetup->addAttributeGroup(
- $entityTypeId,
- $attributeSet = $attributeSetId ,
- 'medicamento_expira_curta2_group',
- 200
- );
- $eavSetup->removeAttribute(MagentoCatalogModelProduct::ENTITY,'medicamento_expira_curta2');
- $eavSetup->addAttribute(
- MagentoCatalogModelProduct::ENTITY, 'medicamento_expira_curta2', /* Custom Attribute Code */
- [
- 'group' => 'medicamento_expira_curta_group2',/* Group name in which you want
- to display your custom attribute */
- 'type' => 'int',/* Data type in which formate your value save in database*/
- 'backend' => '',
- 'frontend' => '',
- 'label' => 'DATATESTESCOPED2', /* lablel of your attribute*/
- 'input' => 'date',
- 'class' => '',
- // 'source' => 'ModuleNameSpaceYourModuleNameModelConfigSourceOptions',
- /* Source of your select type custom attribute options*/
- 'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
- /*Scope of your attribute */
- 'visible' => true,
- 'required' => true,
- 'user_defined' => true,
- 'default' => '',
- 'searchable' => false,
- 'filterable' => false,
- 'comparable' => false,
- 'visible_on_front' => false,
- 'used_in_product_listing' => true,
- 'unique' => false,
- 'attribute_set_id' => 'medicamento_expira_curta2'
- ]
- );
Add Comment
Please, Sign In to add comment