custom module for cutom attribute image field in category section in magento backend

create custom module
here my module name is Dr_Attribute.
delete all folder from app/code/local/[modulename]
except two folder etc and sql folder
etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Dr_Attribute>
            <version>0.1.0</version>
        </Dr_Attribute>
    </modules>
    <global>
         <resources>
            <attribute_setup>
                <setup>
                    <module>Dr_Attribute</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </attribute_setup>
            <attribute_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </attribute_write>
            <attribute_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </attribute_read>
        </resources>
        <blocks>
            <attribute>
                <class>Dr_Attribute_Block</class>
            </attribute>
        </blocks>
        <helpers>
            <attribute>
                <class>Dr_Attribute_Helper</class>
            </attribute>
        </helpers>
    </global>
</config>
now plz make changes into sql mysql file

sql/attribute_setup/mysql4-install-0.1.0

<?php

$installer = $this;
$installer->startSetup();


$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_category', 'bgimage', array(
    'input'         => 'image',
    'type'          => 'varchar',
    'group' => 'background',
    'label'         => 'background image',
    'visible'       => 1,
    'required'      => 0,
    'user_defined' => 1,
    'frontend_input' =>'',
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible_on_front'  => 1,
));


$installer->endSetup();

then find "attribute_code" from the "eav_attribute" table and add "catalog/category_attribute_backend_image" to backend_model in DB Structure manually to database.

then refresh the page you can see image attribute in manage category option in Backend magento

Thanks!

Comments