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_quote_item 和 sales_flat_order_item 添加新列)
本文介绍了Magento - 向 sales_flat_quote_item 和 sales_flat_order_item 添加新列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在使用 Magento 版本 1.4.1.1,我想在 sales_flat_quote_item 表中保存一个值(并将其传递给 sales_flat_order_item).

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).

我找到了本教程,但我不确定它仍然相关(对于 Magento 版本 1.4.1.1),因为它讨论了一个名为 sales_order 的表,我认为它现在是 sales_flat_order 并且看起来有点不同.

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.

这个方法还能用吗?如果是这样 - 我可以将它用于 sales_flat_quote_itemsales_flat_order_item 以及我应该在推荐中放入什么 entity_type_id :

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);`

如果在新的 Magento 版本中这不是这样做的方法,我应该怎么做?

If this is not the way to do that in the new Magento version, how should I do that?

谢谢,沙尼

推荐答案

  1. 使用从 Mage_Sales_Model_Mysql4_Setup 扩展的自己的设置类创建一个新模块,或者将其用作 config.xml 中的模块设置类:

  1. Create a new module with own setup class extended from Mage_Sales_Model_Mysql4_Setup or just use it as module setup class in config.xml:

 <global>
     <resources>
         <your_module_setup>
              <setup>
                  <module>Your_Module</module>
                  <class>Mage_Sales_Model_Mysql4_Setup</class>
              </setup>
         </your_module_setup>
     </resources>
 </global>

  • 在设置脚本中使用 addAttribute($entity, $attributeCode, $options) 方法,它会自动向 sales_flat_order 故事添加一个新列.其他实体也是如此.

  • 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.

    $installer = $this;
    $installer->startSetup();
    $installer->addAttribute(
        'order', 
        'your_attribute_code', 
        array(
            'type' => 'int', /* varchar, text, decimal, datetime */,
            'grid' => false /* or true if you wan't use this attribute on orders grid page */
        )
    );
    $installer->endSetup();
    

  • 这篇关于Magento - 向 sales_flat_quote_item 和 sales_flat_order_item 添加新列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

    本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

    相关文档推荐

    DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
    PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
    mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
    Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
    Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
    Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)