Hello, Here is the another magento code snippet that i have got to share with you.
[php]
<?php
require_once("app/Mage.php");
Mage::app('default');
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$installer->addAttribute('catalog_category', 'left_nav', array(
'group' => 'General Information',
'type' => 'int',
'label' => 'Show in left navigation',
'input' => 'select',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => 0,
'source' => 'eav/entity_attribute_source_boolean'
));
?>
[/php]
After running this script and refreshing the admin end you will find the added attribute at end of General Information tab.
Hope this helps some one
Thanks.
How to run this code
ReplyDeleteJust create a file like test.php and put all the above code (Adjust it with your settings)Place it on the root folder and run from the browser.
ReplyDeleteRavi