Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

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.

like image 904
liquidity Avatar asked Feb 08 '11 23:02

liquidity


1 Answers

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 where Duedate > MMDDYY.

like image 91
Morningtime Digital Media Avatar answered Oct 09 '22 06:10

Morningtime Digital Media