Guest User

Untitled

a guest
Jan 17th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
  2. $attributeSet = $this->attributeSetFactory->create();
  3. $entityTypeId = $categorySetup->getEntityTypeId(MagentoCatalogModelProduct::ENTITY);
  4. $attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId, 'medicamento_expira_curta2');
  5. $autosettingsTabName = 'medicamento_expira_curta2_group';
  6. $categorySetup->addAttributeGroup($entityTypeId, $attributeSetId, $autosettingsTabName, 60);
  7. $data = [
  8. 'attribute_set_name' => 'medicamento_expira_curta2',
  9. 'entity_type_id' => $entityTypeId,
  10. 'sort_order' => 200,
  11. ];
  12. $attributeSet->setData($data);
  13. $attributeSet->validate();
  14. $attributeSet->save();
  15. $attributeSet->initFromSkeleton($attributeSetId);
  16. $attributeSet->save();
  17.  
  18. $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
  19.  
  20. $eavSetup->addAttributeGroup(
  21. $entityTypeId,
  22. $attributeSet = $attributeSetId ,
  23. 'medicamento_expira_curta2_group',
  24. 200
  25. );
  26.  
  27.  
  28. $eavSetup->removeAttribute(MagentoCatalogModelProduct::ENTITY,'medicamento_expira_curta2');
  29. $eavSetup->addAttribute(
  30. MagentoCatalogModelProduct::ENTITY, 'medicamento_expira_curta2', /* Custom Attribute Code */
  31. [
  32. 'group' => 'medicamento_expira_curta_group2',/* Group name in which you want
  33. to display your custom attribute */
  34. 'type' => 'int',/* Data type in which formate your value save in database*/
  35. 'backend' => '',
  36. 'frontend' => '',
  37. 'label' => 'DATATESTESCOPED2', /* lablel of your attribute*/
  38. 'input' => 'date',
  39. 'class' => '',
  40. // 'source' => 'ModuleNameSpaceYourModuleNameModelConfigSourceOptions',
  41. /* Source of your select type custom attribute options*/
  42. 'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
  43. /*Scope of your attribute */
  44. 'visible' => true,
  45. 'required' => true,
  46. 'user_defined' => true,
  47. 'default' => '',
  48. 'searchable' => false,
  49. 'filterable' => false,
  50. 'comparable' => false,
  51. 'visible_on_front' => false,
  52. 'used_in_product_listing' => true,
  53. 'unique' => false,
  54. 'attribute_set_id' => 'medicamento_expira_curta2'
  55. ]
  56. );
Add Comment
Please, Sign In to add comment