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 :
So, in your opinion, which of the two ways is the best ?
Thanks, Hugues.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With