Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <?php
  2.  
  3. namespace VendorModuleSetup;
  4.  
  5. use MagentoEavSetupEavSetupFactory;
  6. use MagentoFrameworkSetupInstallDataInterface;
  7. use MagentoFrameworkSetupModuleContextInterface;
  8. use MagentoFrameworkSetupModuleDataSetupInterface;
  9.  
  10. class InstallData implements InstallDataInterface
  11. {
  12. /**
  13. * EAV setup factory
  14. *
  15. * @var EavSetupFactory
  16. */
  17. private $eavSetupFactory;
  18.  
  19. /**
  20. * Init
  21. *
  22. * @param EavSetupFactory $eavSetupFactory
  23. */
  24. public function __construct(EavSetupFactory $eavSetupFactory)
  25. {
  26. $this->eavSetupFactory = $eavSetupFactory;
  27. }
  28.  
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
  33. {
  34. $setup->startSetup();
  35. $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
  36. $eavSetup->addAttribute(
  37. MagentoCatalogModelProduct::ENTITY,
  38. 'product_profile',
  39. [
  40. 'group' => 'My Group',
  41. 'type' => 'varchar',
  42. 'input' => 'select',
  43. 'source' => 'VendorModuleBlockAdminhtmlProductEditTabProfileSelect',
  44. 'label' => 'Profile',
  45. 'required' => false,
  46. 'user_defined' => true,
  47. 'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
  48. 'used_in_product_listing' => true,
  49. ]
  50. );
  51. $setup->endSetup();
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement