Magento 付款:additional_information 或 payment 属性?
我想知道在 magento (1.4.1.1) 中向付款添加一些信息的更好方法是什么。
假设我想添加一个名为“ payment_duedate ”的信息,这是客户必须支付发票的日期。
实际上,sales_flat_order_ payment 中有一个名为“additional_information”的字段,其中包含通过 setAdditionalInformation($arg1,$arg2); 方法设置的序列化数据。可用于“销售/付款”模式。 因此,我可以通过以下方式保存我的日期:
$payment->setAdditionalInformation('payment_duedate',$myDate);
$payment->save();
但也可以选择添加付款属性,这将有效地在“sales_flat_order_ payment”中创建一个名为“ payment_duedate”的新列,然后通过以下方式保存我的日期:
$payment->setPaymentDuedate($myDate);
$payment->save();
主要区别是:
- 使用“additional_information方法”,数据被序列化,因此不容易查询。
- 使用“setPaymentDuedate() 方法”,数据是可查询的,并且在表中创建了一个新字段
那么,在您看来,这两种方法中哪一种是最好的?
谢谢,胡格斯。
I'm wondering which is the better way to add some information to a payment in 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.
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();
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();
The main differences are :
- with the "additional_information method", datas are serialized, and so, not queryable easily.
- with the "setPaymentDuedate() method", datas are queryable and a new field is created in the table
So, in your opinion, which of the two ways is the best ?
Thanks, Hugues.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
setAdditionalInformation()
对于只读属性最有用,例如给用户的消息,如“交易银行:MyBank”。自定义
setPaymentDuedate()
对于后续处理非常有用,例如检查Duedate > 的付款状态。 MMDDYY。
The
setAdditionalInformation()
is most useful for read-only attributes, such as a message to the user, like "Transaction Bank: MyBank".The custom
setPaymentDuedate()
is useful for processing afters, like checking a payment status whereDuedate > 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.