Create custom attribute in magento category

HI friends to create custom attribute for product is to easy , but for a category its tricky. For creating attribute in category general tab use this code and create a new file, place it in root folder like
http://localhost/magento-1.6.2.0/magento/attribute.php and run it.

its All done enjoy:)

<?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'=> 'Is Open',
    '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', 'is_open', $attribute);
$installer->endSetup();?>

Comments

Popular posts from this blog

Category Name with Products in Cart Page Magento

Safe name of a file by php

Sort Products by popularity count in Magento