3

如何在 magento 中获取付款方式的标题?我也有一些相关的问题:

  • 如何添加在评论订单页面上选择的付款方式(我覆盖了页面,但我不知道如何调用当前 qoute 的付款方式。我使用过

    Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getData()

    但它只是为我提供付款方式代码而不是标题

  • 如何通过代码获取付款方式名称?

4

4 回答 4

16

你可以这样做:

$mcode = Mage::getSingleton('checkout/session')
    ->getQuote()
    ->getPayment()
    ->getMethodInstance()
    ->getTitle();

echo Mage::getStoreConfig('payment/' . $mcode . '/title');
于 2012-11-03T10:00:20.680 回答
11

Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance()->getTitle();

通过代码获取付款方式:

Mage::helper('payment')->getMethodInstance($payment_code);

于 2012-09-15T14:21:03.817 回答
0

你可以这样做

$payments = Mage::getSingleton('payment/config')->getActiveMethods();
$methods = array(array(
    'value'=>'',
    'label'=>Mage::helper('adminhtml')->__('--Please Select--')
));

foreach ($payments as $paymentCode=>$paymentModel) {
    $paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
    $methods[$paymentCode] = array(
        'label'   => $paymentTitle,
        'value' => $paymentCode,
    );
}

echo "<xmp>";
print_r($methods);
echo "</xmp>";
于 2014-07-14T05:47:11.560 回答
0

这对我来说是使用付款代码获取实际付款方式标题的诀窍:

Mage::helper('payment')->getMethodInstance([payment_code])->getTitle();

参考:建立在@Lucas Moeskops 的回答(+1'ed you)

于 2016-03-23T17:13:58.557 回答