Reputation: 767
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.
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>
Upvotes: 0
Views: 2948
Reputation: 1068
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 uses these fieldsets
to transport data from entity to entity. In this case from the quote_payment
to the order_payment
.
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.
Upvotes: 2