Pages

Wednesday 7 January 2015

Magento:: Add custom attribute field in category

Note:- write down the code in head.phtml and give permission after run one time remove the code
<?php  require_once('app/Mage.php');
    Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
    $installer = new Mage_Sales_Model_Mysql4_Setup;
    $attribute = array(
    'type' => 'int',
    'label'=> 'Featured Category',
    'input' => 'select',
    'source' => 'eav/entity_attribute_source_boolean',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible' => true,
    'required' => false,
    'user_defined' => true,
    'default' => 0,
    'group' => "General Information"
    );
    $installer->addAttribute('catalog_category', 'featured_category', $attribute);
    $installer->endSetup();
?>

No comments:

Post a Comment