public function addcategoryattribute2Action() {
$installer = Mage::getResourceModel('catalog/setup','catalog_setup');
$installer->startSetup();
$attribute = array(
'type' => 'varchar',
'label' => 'Active End Date',
'input' => 'date',
'source' => '',
'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', 'active_end_date', $attribute);
$installer->endSetup();
$installer = Mage::getResourceModel('catalog/setup','catalog_setup');
$installer->startSetup();
$attribute = array(
'type' => 'varchar',
'label' => 'Active End Date',
'input' => 'date',
'source' => '',
'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', 'active_end_date', $attribute);
$installer->endSetup();
}
加在controller 中
当type 是select 的时候,若需要用动态的option,则需要在source 中添加自定义的数据来源