Magento的信用卡详细信息

时间:2011-01-03 09:15:23

标签: php magento

如何从OnepageController.php获取Magento中的信用卡详细信息? 我已检索到所有其他信息,如结算信息,送货信息和用户详细信息。我使用以下内容获取卡片详细信息,但它返回空白:

$lastQuoteId = $session->getLastQuoteId();
$lastOrderId = $session->getLastOrderId();
$order  = Mage::getModel('sales/order')->load($lastOrderId);
$card_exp_month     = $order->getCcExpMonth($lastOrderId);///(Nahi AAya)
$card_exp_year      = $order->getCcExpYear($lastOrderId);///(Nahi AAya)

当我打印$card_exp_month$card_exp_year时,两者都是空白的。还有另一种方法可以确定信用卡的详细信息吗?我正在寻找CC编号,到期年份和到期月份。

5 个答案:

答案 0 :(得分:4)

而不是$order->getCcExpMonth($lastOrderId)尝试$order->getPayment()->getCcExpMonth($lastOrderId)

使用print_r($order->getPayment()->debug())查看其他可用值,或查看sales_flat_order_payment表以查看更多示例。

答案 1 :(得分:2)

CC最后4:$order->getPayment()->getCcLast4()

Exp Info: $order->getPayment()->getCcExpMonth() $order->getPayment()->getCcExpYear()

答案 2 :(得分:1)

我在phtml文件中获得了卡片详细信息,如下所示。

$lastOrderId = Mage::getSingleton('checkout/session')
                                        ->getLastRealOrderId();

$order=Mage::getModel('sales/order')->loadByIncrementID($lastOrderId);
$payarry=$order->getPayment()->debug();
foreach($payarry as $key => $cardinfo)
{                   
    echo $key;
    echo $cardinfo;                     
}

答案 3 :(得分:1)

另外

        $quote = Mage::getSingleton('checkout/session')->getQuote();  // or load by id
        $order = $quote->getOrder();
        $payment = $quote->getPayment();
        $instance = $payment->getMethodInstance();

        $ccNumber = $instance->getInfoInstance()->getCcNumber();
        $ccExpMonth = $instance->getInfoInstance()->getCcExpMonth();

以及CcCid,CcOwner等......

答案 4 :(得分:0)

            <?php

            require_once("app/Mage.php");
            $app = Mage::app('');
            $salesModel=Mage::getModel("sales/order");
            $salesCollection = $salesModel->getCollection();
            foreach($salesCollection as $order)
            {
                $orderId= $order->getIncrementId(); echo "<br/>";
                echo $orderId;

            $payarry=$order->getPayment()->debug();
            foreach($payarry as $key => $cardinfo)
            {     
                 echo"<pre>"; print_r($payarry);

                //echo $key; echo "<br/>";
                //echo $cardinfo;       echo "<br/>";               
            }

            }


            ?>
相关问题