Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 25th, 2012  |  syntax: None  |  size: 2.05 KB  |  hits: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. how to add custom fields in magento payment module
  2. class Excellence_Pay_Block_Info_Pay extends Mage_Payment_Block_Info
  3.     {
  4.         protected function _prepareSpecificInformation($transport = null)
  5.         {
  6.             if (null !== $this->_paymentSpecificInformation) {
  7.                 return $this->_paymentSpecificInformation;
  8.             }
  9.             $info = $this->getInfo();
  10.             $transport = new Varien_Object();
  11.             $transport = parent::_prepareSpecificInformation($transport);
  12.             $transport->addData(array(
  13.                 Mage::helper('payment')->__('Voucher #') => $info->getCheckNo(),
  14.                 Mage::helper('payment')->__('Voucher Date') => $info->getCheckDate(),
  15.                 Mage::helper('payment')->__('Field Date') => $info->getCheckField(), //custom field
  16.                 Mage::helper('payment')->__('Field new') => $info->getCheckField1() //custom field
  17.             ));
  18.             return $transport;
  19.         }
  20.     }
  21.  
  22. I change the code to this in block/info, and change some code in model/pay.php
  23.  
  24.  
  25.  
  26.  
  27. public function assignData($data)
  28.         {
  29.             if (!($data instanceof Varien_Object)) {
  30.                 $data = new Varien_Object($data);
  31.             }
  32.             $info = $this->getInfoInstance();
  33.             $info->setCheckNo($data->getCheckNo())
  34.             ->setCheckDate($data->getCheckDate())
  35.             ->setCheckField($data->getCheckField())
  36.             ->setCheckField1($data->getCheckField1());
  37.             return $this;
  38.         }
  39.        
  40. <fieldsets>
  41.              <sales_convert_quote_payment>
  42.                 <check_no>
  43.                     <to_order_payment>*</to_order_payment>
  44.                 </a>
  45.                 <check_date>
  46.                     <to_order_payment>*</to_order_payment>
  47.                 </check_date>
  48.                 <check_field>
  49.                     <to_order_payment>*</to_order_payment>
  50.                 </check_field>
  51.                 <check_field1>
  52.                     <to_order_payment>*</to_order_payment>
  53.                 </check_field1>
  54.              </sales_convert_quote_payment>
  55.         </fieldsets>