[英]Magento payment : additional_information or payment attribute?
I'm wondering which is the better way to add some information to a payment in magento (1.4.1.1). 我想知道在magento(1.4.1.1)中向支付添加一些信息的更好方法是哪种。
Let's say I want to add an information called "payment_duedate" which would be the date the customer has to pay his invoice. 假设我想添加一个名为“payment_duedate”的信息,该信息将是客户支付发票的日期。
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); 实际上,sales_flat_order_payment中有一个名为“additional_information”的字段,其中包含方法setAdditionalInformation($ arg1,$ arg2)设置的序列化数据; available in the 'sales/payment' model.
可在“销售/付款”模式中使用。 So I could save my date by :
所以我可以通过以下方式保存日期:
$payment->setAdditionalInformation('payment_duedate',$myDate);
$payment->save();
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 : 但是也可以选择添加支付属性,这样可以在'sales_flat_order_payment'中创建一个名为'payment_duedate'的新列,然后通过执行以下操作来保存我的日期:
$payment->setPaymentDuedate($myDate);
$payment->save();
The main differences are : 主要区别是:
So, in your opinion, which of the two ways is the best ? 那么,在您看来,这两种方式中哪一种最好?
Thanks, Hugues. 谢谢,Hugues。
The setAdditionalInformation()
is most useful for read-only attributes, such as a message to the user, like "Transaction Bank: MyBank". setAdditionalInformation()
对于只读属性最有用,例如向用户发送的消息,如“Transaction Bank:MyBank”。
The custom setPaymentDuedate()
is useful for processing afters, like checking a payment status where Duedate > MMDDYY
. 自定义
setPaymentDuedate()
对于处理后续操作非常有用,例如检查Duedate > MMDDYY
的付款状态。
I find the question to be subjective. 我觉得这个问题是主观的。 And given that the second way isn't much more effort (see my experiences ) it's hard to choose either one.
鉴于第二种方式不是更多努力(参见我的经验 ),很难选择其中任何一种。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.