如何获取Magento上的付款信息?

2022-08-31 00:15:07

我必须将订单导出到一个文件,这是我的代码来检查订单:

    $orders = Mage::getModel('sales/order')->getCollection()
    ->addAttributeToSelect(array('status', 'ncm'))
    ->addFieldToFilter(
        array(
            array('attribute' => 'status', 'eq' => 'complete')
        )
    );

    $order = $orders->getFirstItem();

    //print_r($order);
    //exit;
    //foreach($orders as $order){
    $id = $order->getIncrementId();

    $payment = $order->getPayment();
    $method = $payment->getMethodInstance();

    print_r($payment);
    //}

我需要打印一些关于付款的信息,例如方法,金额,拆分的月份,如果是信用卡,我需要交易的重新utrning ID,因此列表还在继续

我该怎么做?


答案 1

我认为这将是

   $payment = $order->getPayment();

它将检索当前订单付款实例。


答案 2
//Get Payment
$payment = $order->getPayment()

//Get card type
$payment->getData('cc_type')

//Get Payment Info
$payment->getMethodInstance()->getCode();
$payment->getMethodInstance()->getTitle();

//Get Credit Card info
$payment->getMethodInstance()->getCardsStorage()
$payment->getMethodInstance()->getCardsStorage()->getCards() //array()

推荐