作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何获取支付网关模型中 cc_type
的值(文本,而不是代码)?
在 authorize()
和 capture()
的支付网关模型中,我确实获得了 $ payment
对象,从中我确实获得了 cc_type
为 $ payment->getCcType()
但它返回 cc_type
的代码,我如何获取代码的值。例如,对于 VISA,它返回 VI。那么,我如何从 $ payment
或 $ payment->getCcType()
获得 VISA 呢?
最佳答案
如果此时您只有抄送代码('VI'
、'MA'
等),您可以使用:
// $sType = 'VI';
$sType = $payment->getCcType();
$aType = Mage::getSingleton('payment/config')->getCcTypes();
if (isset($aType[$sType])) {
$sName = $aType[$sType];
}
else {
$sName = Mage::helper('payment')->__('N/A');
}
如果您此时已经拥有 Mage_Payment_Model_Info
block ,则可以使用:
$sName = $payment->getMethod()->getInfoInstance()->getCcTypeName();
关于php - 在magento中获取cc_type值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22828651/
我是一名优秀的程序员,十分优秀!