本文介绍了Magento:如何将数据保存到order_payment和quote_payment的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将自定义信用卡付款属性保存到两个不同的表中,但是我不确定该怎么做.

I'm trying to have a custom credit card payment attribute save to two different tables but I'm not sure how to do this.

正常的信用卡信息保存到两个不同的表中.

The normal credit card information saves to two different tables.

  • sales_flat_quote_payment
  • sales_flat_order_payment

我创建了新属性,应将其保存到两个表中.在两个表上都设置了具有正确值的列,但是只有在客户下订单时,它才保存为一个"sales_flat_quote_payment".

I created the new attribute and it should be saved to both tables. The column with the correct value has been set on both tables but it only saves to one "sales_flat_quote_payment" right when the customer places the order.

我如何做到这一点,以便将数据保存到两个表中?

How can I make it so it saves the data to both tables?

我找到了此参考,但是我不确定如何实现它以使其与信用卡属性值一起使用.

I found this reference but I'm not sure how to implemente it to make it work with a credit card attribute value.

http://www.magentocommerce.com/boards/viewthread/19344/P0 /

任何人都可以确认这是否行得通吗?

Can anyone confirm if this would work?

    <sales_copy_order_payment>
        <cc_bankname>
        <to_order>*</to_order>
        </cc_bankname>
    </sales_copy_order_payment>

推荐答案

您是否配置了Magento将新属性从报价转换为订单?如果从Mage_Sales模块检查config.xml并搜索sales_convert_quote_payment.您将看到以下内容:

Did you configure Magento to convert the new attribute from quote to order? If you check the config.xml from the Mage_Sales module and search for sales_convert_quote_payment. You see something as follows:

       <sales_convert_quote_payment>
            <method><to_order_payment>*</to_order_payment></method>
            <additional_data><to_order_payment>*</to_order_payment></additional_data>
            <additional_information><to_order_payment>*</to_order_payment></additional_information>
            <po_number><to_order_payment>*</to_order_payment></po_number>
            <cc_type><to_order_payment>*</to_order_payment></cc_type>
            <cc_number_enc><to_order_payment>*</to_order_payment></cc_number_enc>
            <cc_last4><to_order_payment>*</to_order_payment></cc_last4>
            <cc_owner><to_order_payment>*</to_order_payment></cc_owner>
            <cc_exp_month><to_order_payment>*</to_order_payment></cc_exp_month>
            <cc_exp_year><to_order_payment>*</to_order_payment></cc_exp_year>

            <cc_number><to_order_payment>*</to_order_payment></cc_number>
            <cc_cid><to_order_payment>*</to_order_payment></cc_cid>

            <cc_ss_issue><to_order_payment>*</to_order_payment></cc_ss_issue>
            <cc_ss_start_month><to_order_payment>*</to_order_payment></cc_ss_start_month>
            <cc_ss_start_year><to_order_payment>*</to_order_payment></cc_ss_start_year>
        </sales_convert_quote_payment>

Magento使用这些fieldsets在实体之间传输数据.在这种情况下,从quote_paymentorder_payment.

Magento uses these fieldsets to transport data from entity to entity. In this case from the quote_payment to the order_payment.

由于所有config XML都合并为一大堆XML,因此您可以从自己的模块config.xml中添加其他节点.像这样:

Since all config XML is merged into one big heap of XML, you can add additional nodes from your own modules config.xml. Something like:

<global>
    <fieldsets>
        <sales_convert_quote_payment>
            <your_attribute><to_order_payment>*</to_order_payment></your_attribute>
        </sales_convert_quote_payment>
    </fieldsets>
</global>

希望这可以帮助您开展工作.

Hope this helps you get underway.

这篇关于Magento:如何将数据保存到order_payment和quote_payment的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 11:48