0

I´ve been able to add a custom field called Bank Name to the credit card payment option which saves into the DB, however I am now trying to display such information on the back-end under Customer > Manage Customer > (Select an customer) > Orders > (Select an Order) and there´s a field called Payment Information which displays the credit card payment info and this is where I want the Bank Name to appear.

I have already tried to edit the following files with no success.

app\design\adminhtml\default\default\template\payment\form\cc.phtml and ccsave.phtml by adding the following.

<div class="input-box">
        <label for="<?php echo $_code ?>_cc_bankname><?php echo Mage::helper('payment')->__('Bank Name') ?> <span class="required">*</span></label><br/>
        <input type="text" id="<?php echo $_code ?>_cc_bankname" name="payment[cc_bankname]" title="<?php echo Mage::helper('payment')->__('Bank Name') ?>" class="input-text validate-cc-number" value="<?php echo $this->getInfoData('cc_bankname')?>"/>
    </div>

but this only enables the option to edit the attribute when manually creating a new order for the customer.

Does anyone know which file should be edited and how? I´ve tried to edit the cc.phtml and ccsave.phtml files under add/design/adminhtml and also under mage but no luck.

Forgot to mention I´m working with Magento 1.7

::::::::::::::::EDIT::::::::::::::::

After further search thru the payment files, I found that there are two files that need to be edited but I still need some help.

I adited \app\code\local\Mage\Payment\Block\Info\cc.phtml by adding two functions to the file.

First a public function

public function getCcBankname()
{   
    return $this->getInfo()->getCcBankname();
}

Then a protected function

if ($this->getInfo()->getCcBankname()) {
        $data[Mage::helper('payment')->__('Bank Name')] = $this->getInfo()->getCcBankname();
    }

Then I edited the following file \app\code\local\Mage\Payment\Block\Info\ccsave.phtml by adding this.

$transport = new Varien_Object(array(Mage::helper('payment')->__('Bank Name') => $info->getCcBankname(),));

Now this modifications allowed for the Bank Name to appear on the Backend exactly where I wanted it BUT the problem is that it not populating the data that´s store on the DB.

Anyone knows why it´s not pulling the data from the DB?

:::::::::::::::: EDIT #2 ::::::::::::::::

Well it seems that everything I did worked but there was just one little problem. The bank name data should be set on two different Tables. sales_flat_order_payment and sales_flat_quote_payment but for some reason the data is only saving on sales_flat_quote_payment. I manually entered the data on sales_flat_order_payment and it worked, I was able to visualize the Bank Name on the backend.

Now I have to figure out how to get the data to save on sales_flat_order_payment whenever a payment is processed and why it´s being saved on sales_flat_quote_payment but not on the other.

BlueSun3k1
  • 757
  • 5
  • 21
  • 39

1 Answers1

1

For the payment method ccsave, the "Payment Information" section of

Customer > Manage Customer > (Select customer) > Orders > (Select Order)

is usually created by the template

app/design/adminhtml/default/default/template/payment/info/default.phtml
Jürgen Thelen
  • 12,745
  • 7
  • 52
  • 71
  • Thanks, I looked into the default.phtml file and I only found a code that does not help me much. htmlEscape($this->getMethod()->getTitle()) ?> getSpecificInformation()):?> $_value):?>
    escapeHtml($_label)?>: getValueAsArray($_value, true), "\n"))?>
    getChildHtml()?>
    – BlueSun3k1 Aug 13 '12 at 18:58
  • This is what was missing in my case. I override the original info block with mine and forgot to create the template for the adminhtml section – Wilman Arambillete Nov 12 '13 at 10:17