我尝试更新自定义模型,为我的模型添加两个新属性。
我修改了 config.xml 文件,添加了版本 0.0.2 ,我在sql文件夹中创建了一个名为 mysql4-upgrade-0.0.1的新php文件-0.0.2.php
文件正确执行但Magento生成的报告错误包含一般错误,上面写着“文件中的错误... ”
您可以在下面找到我的代码:
<?php
$installer = $this;
$installer->startSetup();
$installer->addAttribute("configurador/vista", "radiovertical", array(
"type" => "dec",
"backend" => "",
"frontend" => "",
"label" => "Radio Vertical",
"input" => "text",
"class" => "",
"source" => "",
"global" => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
"visible" => true,
"required" => true,
"user_defined" => false,
"default" => "",
"searchable" => false,
"filterable" => false,
"comparable" => false,
"visible_on_front" => false,
"unique" => false,
"note" => ""
));
$installer->addAttribute("configurador/vista", "radiohorizontal", array(
"type" => "dec",
"backend" => "",
"frontend" => "",
"label" => "Radio horizontal",
"input" => "text",
"class" => "",
"source" => "",
"global" => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
"visible" => true,
"required" => true,
"user_defined" => false,
"default" => "",
"searchable" => false,
"filterable" => false,
"comparable" => false,
"visible_on_front" => false,
"unique" => false,
"note" => ""
));
$installer->endSetup();
有人能说我做错了吗?
提前致谢
答案 0 :(得分:0)
"configurador/vista"
可能应该替换为'catalog_product'
。 addAttribute()
的第一个字段是entity_type_id
。可以在表eav_entity_type中找到该字段的所有可用值(您可以使用entity_type_id或entity_type_code)