2011-01-03 11 views
6

में क्रेडिट कार्ड का विवरण 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 प्रिंट, दोनों खाली कर रहे हैं। क्या कोई दूसरा तरीका है जिसके द्वारा मैं क्रेडिट कार्ड का विवरण निर्धारित कर सकता हूं? मैं सीसी संख्या, समाप्ति वर्ष और समाप्ति माह की तलाश में हूं।

+1

// Nahi आया :) +1 एक स्वाद के साथ एक अच्छा सवाल के लिए। – Chiragit007

+0

http://stackoverflow.com/a/24047065/3338098 – user3338098

उत्तर

4

$order->getCcExpMonth($lastOrderId) के बजाय $order->getPayment()->getCcExpMonth($lastOrderId) का प्रयास करें।

अन्य मूल्यों को देखने के लिए print_r($order->getPayment()->debug()) का उपयोग करें या अन्य उदाहरण देखने के लिए sales_flat_order_payment तालिका देखें।

+0

'gettype (...-> getCcType()) == 'शून्य' और gettype (...-> getCcLast4()) == 'null'') इसलिए Magento v1.5.1.0 – user3338098

+0

के लिए उत्तर नहीं http://stackoverflow.com/a/24047065/3338098 – user3338098

1

सीसी अंतिम 4: $order->getPayment()->getCcLast4()

ऍक्स्प जानकारी: $order->getPayment()->getCcExpMonth() $order->getPayment()->getCcExpYear()

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;      
} 
0

इसके अलावा

 $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, आदि के लिए ...

+0

'gettype (...-> getCcType()) == 'null' और gettype (...- > getCcLast4()) == 'null'' तो magento v1.5.1.0 – user3338098

+0

का उत्तर नहीं है http://stackoverflow.com/a/24047065/3338098 – user3338098

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/>";    
      } 

      } 


      ?> 
+0

क्या आप कृपया अपने उदाहरण के बारे में थोड़ा और स्पष्टीकरण प्रदान कर सकते हैं? – Blunderfest

 संबंधित मुद्दे