Hello. I am Marvin. Anyone here can help how to create Magento attributes using Magento Extension. Here is the instruction:
Solved! Go to Solution.
Thanks. I also tried Silk Software website easily generate files on creating attributes.
Hi @Marvin261,
You can create an installer script, with something like this:
$installer = $this;
$installer->startSetup();
$attribute_set_id = $installer->getDefaultAttributeSetId(Mage_Catalog_Model_Product::ENTITY);
$attribute_group_id = $installer->getAttributeGroupId(Mage_Catalog_Model_Product::ENTITY, $attribute_set_id, 'General');
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'display_product', array(
'type' => 'int',
'frontend' => '',
'label' => 'Display product',
'input' => 'select',
'backend' => '',
'class' => '',
'source' => 'eav/entity_attribute_source_boolean',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'default' => '',
'searchable' => 0,
'filterable' => 0,
'comparable' => 0,
'visible_on_front' => 1,
'unique' => 0,
'position' => 15,
));
$installer->addAttributeToGroup(
Mage_Catalog_Model_Product::ENTITY,
$attribute_set_id,
$attribute_group_id,
'display_product',
'15'
);
$installer->endSetup();