且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Magento Admin中更改信用卡信息的显示

更新时间:2023-11-30 17:32:34

付款明细显示的工作方式是,要显示的任何信息都将在Mage/Payment/Block/Info/的_prepareSpecificInformation()中返回. Ccsave.php文件.您应该感兴趣的代码段是

The way that the payment detail display works is that any information it wants to get displayed is returned in _prepareSpecificInformation() of the Mage/Payment/Block/Info/Ccsave.php file. The chunk of code you should be interested in is

if (!$this->getIsSecureMode()) {
    $transport->addData(array(
        Mage::helper('payment')->__('Expiration Date') => $this->_formatCardDate(
            $info->getCcExpYear(), $this->getCcExpMonth()
        ),
        Mage::helper('payment')->__('Credit Card Number') => $info->getCcNumber(),
    ));
}

我不记得保存CC模式是否也保存了最后4个,但是如果确实保存了,您可以将getCcNumber()换成getCcLast4().如果该按钮不可用,您也可以在$info->getCcNumber()上执行substr()以仅显示最后4个.

I don't recall if Saved CC mode also saves the last 4, but if it does you can just swap out the getCcNumber() with getCcLast4(). If that isn't available, you could also just do a substr() on $info->getCcNumber() to only show the last 4.