Set additional data/information in payment instance
If you want to add the additional information in payment instance, then
Step1
In the Model file of your created payment
Mage_Payment_Model_Method_[custom_name]
add the below code in
assignData()
function
$this->getInfoInstance()->setAdditionalData([value to set]);
for example
$data['pay'] = 'xxxx';
$this->getInfoInstance()->setAdditionalData(serialize($data));
Step2
In Block folder, create payment info file that extends info block,
add the below code in info phtml file
protected $_pay;
public function getPay()
{
if (is_null($this->_pay)) {
$this->_convertAdditionalData();
}
return $this->_pay;
}
protected function _convertAdditionalData()
{
$this->_pay= '';
$data = @unserialize($this->getInfo()->getAdditionalData());
if (is_array($data )) {
$this->_emi = isset($data ['pay']) ? (string) $data ['pay'] : '';
}
return $this;
}
Step3
In the payment info phtml file, add the below code to show the additional data added.
<?php
echo ( if($this->getPay()) ? $this->getPay() : '');
?>
Now check the
additional_data field
in
sales_flat_order_payment
table for that order, you will find the data that added in table.