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

发布于 2024-10-11 23:04:32 字数 660 浏览 1 评论 0原文

我必须将订单导出到文件,这是我的代码来浏览订单:

    $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);
    //}

我需要打印一些有关付款的信息 比如方法,金额,分割了多少个月,如果是信用卡,我需要交易的 reutrning id 等等,

我该怎么做?

I have to export the orders to a file, here is my code to go through the orders:

    $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);
    //}

I need to print some information about the payment
like the method, the amount, how many months it was split, if was credit card, i need the reutrning id of the transaction and so the list goes on

how can I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

转瞬即逝 2024-10-18 23:04:32

我认为它将

   $payment = $order->getPayment();

检索当前订单支付实例。

I think it will be

   $payment = $order->getPayment();

It will retrieve the current order payment instance.

美人骨 2024-10-18 23:04:32
//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()
//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()
双手揣兜 2024-10-18 23:04:32

要仅获取方法代码,使用 Skipping 实例对象要安全得多,

$order->getPayment()->getMethod();

如果卸载支付方法,该对象可能会生成异常。

To get the method code only it's far safer to use

$order->getPayment()->getMethod();

Skipping instance object which can generate exception if the payment method was uninstalled.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文