Magento的付款方式:additional_information或支付属性? [英] Magento payment : additional_information or payment attribute?
问题描述
我不知道这是更好的方式了一些信息添加到在Magento(1.4.1.1)付款。
I'm wondering which is the better way to add some information to a payment in magento (1.4.1.1).
比方说,我想添加一个名为payment_duedate的信息,这将是客户必须支付他的发票日期。
Let's say I want to add an information called "payment_duedate" which would be the date the customer has to pay his invoice.
实际上,存在所谓的additional_information,它包含序列化的数据由方法setAdditionalInformation($ ARG1,$ ARG2)设置sales_flat_order_payment一个场;在销售/支付的模式可用。
所以,我可以救我的日期:
Actually, there is a field in the sales_flat_order_payment called "additional_information" which contain serialized data set by the method setAdditionalInformation($arg1,$arg2); available in the 'sales/payment' model. So I could save my date by :
$payment->setAdditionalInformation('payment_duedate',$myDate);
$payment->save();
不过,我们也可以选择添加一个支付属性,这将具有效力。在'sales_flat_order_payment创建一个名为payment_duedate新列,然后通过做救我的日期:
But one could also choose to add a payment attribute, which would have as effect to create a new column called 'payment_duedate' in the 'sales_flat_order_payment' and then save my date by doing :
$payment->setPaymentDuedate($myDate);
$payment->save();
的主要区别是:
- 与additional_information法的数据都是序列化,因此,不会轻易可查询。
- 与setPaymentDuedate()方法的数据都是可查询和一个新的领域在表中创建
那么,在您看来,这两个方法是最好的?
So, in your opinion, which of the two ways is the best ?
谢谢,雨果。
推荐答案
的 setAdditionalInformation()
是只读的最有用的属性,如消息给用户像交易银行:MyBank。
The setAdditionalInformation()
is most useful for read-only attributes, such as a message to the user, like "Transaction Bank: MyBank".
自定义 setPaymentDuedate()
是加工afters有用,比如检查支付状态,其中 DUEDATE> MMDDYY
。
The custom setPaymentDuedate()
is useful for processing afters, like checking a payment status where Duedate > MMDDYY
.
这篇关于Magento的付款方式:additional_information或支付属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!