Created
March 8, 2016 13:58
-
-
Save eniuz/6e00b201bed52eddcd95 to your computer and use it in GitHub Desktop.
Create Product Attribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// http://blog.chapagain.com.np/magento-adding-attribute-from-mysql-setup-file/ | |
<?php | |
$installer = $this; | |
$setup = new Mage_Eav_Model_Entity_Setup('core_setup'); | |
$installer->startSetup(); | |
/** | |
* Adding Different Attributes | |
*/ | |
// adding attribute group | |
$setup->addAttributeGroup('catalog_product', 'Default', 'Special Attributes', 1000); | |
// the attribute added will be displayed under the group/tab Special Attributes in product edit page | |
$setup->addAttribute('catalog_product', 'testing_attribute', array( | |
'group' => 'Special Attributes', | |
'input' => 'text', | |
'type' => 'text', | |
'label' => 'Testing', | |
'backend' => '', | |
'visible' => 1, | |
'required' => 0, | |
'user_defined' => 1, | |
'searchable' => 1, | |
'filterable' => 0, | |
'comparable' => 1, | |
'visible_on_front' => 1, | |
'visible_in_advanced_search' => 0, | |
'is_html_allowed_on_front' => 0, | |
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, | |
)); | |
$installer->endSetup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment