Friday, 5 May 2017

How to add custom property to magento Attributes?

Step 1: At first run this code.
<?php
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$installer->getConnection()->addColumn(
    $installer->getTable('catalog/eav_attribute'),
    'comment',
    array(
        'type'      => Varien_Db_Ddl_Table::TYPE_TEXT,
        'nullable'  => true,
        'comment'   => 'Comment'
    )
);
$installer->endSetup(); ?>


Step 2:
Then add this code.
/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php

       $fieldset->addField('comment', 'textarea', array(
            'name' => 'comment',
            'label' => Mage::helper('catalog')->__('Comment'),
            'title' => Mage::helper('catalog')->__('Comment'),
            'note' => Mage::helper('catalog')->__('Comment'),
           
        ));

No comments:

Post a Comment