Magento - 向 sales_flat_quote_item 和 sales_flat_order_item 添加新列
我正在使用 Magento 版本 1.4.1.1,我想在 sales_flat_quote_item
表中保存一个值(并将其传递给 sales_flat_order_item
)。
我找到了本教程,但我不确定它是否仍然相关(对于 Magento 版本 1.4.1.1),因为它讨论了一个名为 sales_order
的表,我相信它现在是 sales_flat_order
并且看起来有点不同。
这个方法还应该有效吗?如果是这样 - 我可以将其用于 sales_flat_quote_item
和 sales_flat_order_item
以及我应该在推荐中放入什么 entity_type_id
:
`insert into eav_attribute('entity_type_id','attribute_code','attribute_model','backend_model','backend_type','backend_table','frontend_model','frontend_input','frontend_input_renderer','frontend_label','frontend_class','source_model','is_global','is_visible','is_required','is_user_defined','default_value','is_searchable','is_filterable','is_comparable','is_visible_on_front','is_html_allowed_on_front','is_unique','is_used_for_price_rules','is_filterable_in_search','used_in_product_listing','used_for_sort_by','is_configurable','apply_to','position','note','is_visible_in_advanced_search' )
values(11, 'my_new_column', null, '', 'static', '', '', 'text', '','',null, '', 1,1,1,0,'',0,0,0,0,0,0,1,0,0,0,1,'',0,'',0);`
如果这不是这样做的方法在新的Magento版本中,我应该怎么做?
谢谢, 沙尼
I'm working with Magento version 1.4.1.1, and I want to save a value in sales_flat_quote_item
table (and pass it to sales_flat_order_item
).
I've found this tutorial, but I'm not sure if it's still relevant (to Magento version 1.4.1.1) since it talks about a table called sales_order
, which I believe is now sales_flat_order
and looks a bit different.
Should this method still work? If so - Can I use it for sales_flat_quote_item
and sales_flat_order_item
and what entity_type_id
should I put in the commend :
`insert into eav_attribute('entity_type_id','attribute_code','attribute_model','backend_model','backend_type','backend_table','frontend_model','frontend_input','frontend_input_renderer','frontend_label','frontend_class','source_model','is_global','is_visible','is_required','is_user_defined','default_value','is_searchable','is_filterable','is_comparable','is_visible_on_front','is_html_allowed_on_front','is_unique','is_used_for_price_rules','is_filterable_in_search','used_in_product_listing','used_for_sort_by','is_configurable','apply_to','position','note','is_visible_in_advanced_search' )
values(11, 'my_new_column', null, '', 'static', '', '', 'text', '','',null, '', 1,1,1,0,'',0,0,0,0,0,0,1,0,0,0,1,'',0,'',0);`
If this is not the way to do that in the new Magento version, how should I do that?
Thanks,
Shani
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用从
Mage_Sales_Model_Mysql4_Setup
扩展的自己的设置类创建一个新模块,或者仅将其用作config.xml
中的模块设置类:使用在设置脚本中使用
addAttribute($entity, $attributeCode, $options)
方法,它会自动向 sales_flat_order 故事添加一个新列。其他实体也是如此。Create a new module with own setup class extended from
Mage_Sales_Model_Mysql4_Setup
or just use it as module setup class inconfig.xml
:Use
addAttribute($entity, $attributeCode, $options)
method inside of your setup script, it will automatically add a new column to sales_flat_order tale. The same for other entites.向订单添加属性时需要了解的重要一点:您也需要向引号添加相同的属性(至少在我的情况下,这解决了所有问题)
important thing to know when adding attributes to orders: you need to add the same attributes to quotes, too (at least in my case this solved all problems)