简体   繁体   English

从magento中的自定义模块在sales_flat_order_item表中添加新字段

[英]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.

相关问题 Magento - 向sales_flat_quote_item和sales_flat_order_item添加新列 - Magento - Adding a new column to sales_flat_quote_item and sales_flat_order_item Magento-更新sales_flat_order_item表中发票的数量 - Magento - update the qty invoiced in sales_flat_order_item table 在sales_flat_quote和sales_flat_order_item表中添加额外信息 - Adding extra information in sales_flat_quote and sales_flat_order_item tables 如何将产品特定的属性列添加到sales_flat_order_item表? - How to add product specific attribute column to sales_flat_order_item table? 带有sales_flat_order_item的product_options的_prepareCollection - _prepareCollection with product_options of sales_flat_order_item 在magento中完成订单后,更新sales_flat_order表的自定义列 - Update a custom column of sales_flat_order table after order complete in magento 未完成Magento订单创建sales_flat_quote_item - Magento Order creation sales_flat_quote_item not being made 在一页结帐时,Magento的sales_flat_order表中的customer_email列填充在哪里? - Where does the customer_email column get populated from in the sales_flat_order table in Magento on onepage checkout? Magento-客户地址中的自定义属性,在结帐时未复制到sales_flat_order_address和sales_flat_quote_address - Magento - Custom attribute in customer address, not copied to sales_flat_order_address and sales_flat_quote_address on checkout 在Magento中添加自定义折扣订单总额不会更改销售税 - Adding A Custom Discount Order Total in Magento Does Not Change Sales Tax
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM