Magento - 在模块启动时运行代码

时间:2011-01-11 08:06:40

标签: magento magento-1.4

有没有办法在模块启动时运行这样的代码(一次)来在数据库的表中添加字段

$setup = new Mage_Eav_Model_Entity_Setup ('core_setup');
$setup-> addAttribute ('customer', 'flavor', array (
'label' => 'Ice Cream Flavour'
'type' => 'varchar',
'input' => 'text',
'visible' => true,
'required' => true,
'position' => 1,
));

非常感谢你的帮助。

1 个答案:

答案 0 :(得分:3)

您想查看Magento Setup Resources。这正是它们的创建原因。

相关问题