Last active
August 29, 2015 14:10
-
-
Save St0iK/92e81825ff4a0d621601 to your computer and use it in GitHub Desktop.
Creating Magento product attributes programatically
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 | |
| $installer = $this; | |
| $installer->startSetup(); | |
| $this->addAttribute('catalog_product','brown_product_info', | |
| array ( | |
| 'group' => 'General', | |
| 'type' => 'text', | |
| 'visible_on_front' => true, | |
| 'label' => 'Brown Product Info', | |
| 'input' => 'textarea', | |
| 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, | |
| 'visible' => true, | |
| 'wysiwyg_enabled' => true, | |
| 'default' => '', | |
| 'class' => '', | |
| 'backend' => '', | |
| 'source' => '' | |
| ) | |
| ); | |
| $this->addAttribute('catalog_product','grey_product_info', | |
| array ( | |
| 'group' => 'General', | |
| 'type' => 'text', | |
| 'visible_on_front' => true, | |
| 'label' => 'Grey Product Info', | |
| 'input' => 'textarea', | |
| 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, | |
| 'visible' => true, | |
| 'wysiwyg_enabled' => true, | |
| 'default' => '', | |
| 'backend' => '', | |
| 'class' => '', | |
| 'source' => '' | |
| ) | |
| ); | |
| $installer->addAttribute('catalog_product', "bestseller_favourite", array( | |
| 'type' => 'varchar', | |
| 'input' => 'select', | |
| 'label' => 'Bestseller_Favourite', | |
| 'required' => true, | |
| 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, | |
| 'backend' => 'eav/entity_attribute_backend_array', | |
| 'visible_on_front' => true, | |
| 'option' => array ( | |
| 'values' => array( | |
| 0 => 'Bestseller', | |
| 1 => 'Favourite', | |
| 2 => 'none', | |
| ) | |
| ), | |
| )); | |
| $installer->endSetup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment