[英]Adding new field in sales_flat_order_item table from custom module in magento
In magento i created a custom module and completed the template and controller part, but confused about handling the model and db part. 在magento中,我创建了一个自定义模块并完成了模板和控制器部分,但对处理模型和数据库部分感到困惑。 From my custom module i want to alter the table sales_flat_order_item and add an additional field.
从我的自定义模块中,我想更改表sales_flat_order_item并添加其他字段。 Now i created a set up script like
现在我创建了一个设置脚本,例如
$installer = $this;
$installer->startSetup();
$installer->run("
ALTER TABLE sales_flat_order_item ADD COLUMN new_field TEXT NULL;
ALTER TABLE sales_flat_invoice_item ADD COLUMN new_field TEXT NULL;
ALTER TABLE sales_flat_shipment_item ADD COLUMN new_field TEXT NULL;
");
$installer->endSetup();
in path app\\code\\local\\Namespace\\Module\\sql\\_setup\\mysql4-install-0.1.0.php But the table is not seems to be altered what configuration can be done in the script or module files to add the additional field and processing data with the same like the other fields. 在路径app \\ code \\ local \\ Namespace \\ Module \\ sql \\ _setup \\ mysql4-install-0.1.0.php中,但是该表似乎未更改,可以在脚本或模块文件中进行哪些配置以添加其他字段并像其他字段一样处理数据。 any one help.
任何人的帮助。 Thanks.
谢谢。
what is your config.xml configuration looks like? 您的config.xml配置是什么样的?
under <global></global>
tag you need to add: 在
<global></global>
标记下,您需要添加:
<resources>
<sql_setup>
<setup>
<module>Namespace_Module</module>
</setup>
</sql_setup>
</resources>
try to put something like this 尝试把这样的东西
$installer->run("
ALTER TABLE {$this->getTable('sales_flat_shipment_item')} ADD `new_field` TEXT NULL ;
");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.