Magento payment: additional_information or payment attribute?

I am wondering which of the best ways to add some information to payment in magento (1.4.1.1).

Let's say I want to add information called "payment_duedate", which would be the date the client was supposed to pay their bill.

Actually there is a field in sales_flat_order_payment called "additional_information" that contains serialized data set by the setAdditionalInformation method ($ arg1, $ arg2); available in the sales / payment model. So I could save the date:

$payment->setAdditionalInformation('payment_duedate',$myDate); $payment->save(); 

But you can also add a payment attribute that would have an effect to create a new column named "payment_duedate" in "sales_flat_order_payment" and then save my date by doing:

 $payment->setPaymentDuedate($myDate); $payment->save(); 

The main differences:

  • with the "additional_information method", the data is serialized and therefore cannot be easily queried.
  • with the setPaymentDuedate () "method, the data is requested and a new field is created in the table

So, in your opinion, which of the two methods is the best?

Thanks, Hugues.

+6
php attributes magento
source share
2 answers

setAdditionalInformation() most useful for read-only attributes, such as a message to the user, such as "Transaction Bank: MyBank".

Custom setPaymentDuedate() is useful for handling afters, for example, checking payment status, where Duedate > MMDDYY .

+5
source share

I consider this question subjective. And given that the second method is not much more effort (see my experiments ), it is difficult to choose one of them.

+1
source share

All Articles