1

I was trying to get some details about payment from order and all I achieved is the payment method. Unfortunately I can't get more details like a payment status. So far the code is working well but still ... how to get these details ? Here is my code:

$order_id = $_POST['ordernumber'];///238425;
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
$order->getAllVisibleItems();
$orderItems = $order->getItemsCollection()
    ->addAttributeToSelect('*')
    ->addAttributeToFilter('product_type', array('eq'=>'simple'))
    ->load();
echo '<pre>';
echo 'Mage Order #: '.$order_id.'<br/>';
echo 'Order Total: &pound'.number_format($order->getGrandTotal(),2).'<br/>';
echo 'Qty Ordered: '.number_format($order->getTotalQtyOrdered(),0).'<br/>';
$payment = $order->getPayment();
$method = $payment->getMethod();
$payment->getData('cc_type');
$payment->getMethodInstance()->getCode();
$payment->getMethodInstance()->getTitle();
$payment->getMethodInstance()->getCardsStorage();
$payment->getMethodInstance()->getCardsStorage()->getCards(); //array()
echo 'Payment: '.$method.'<br/>';
echo 'Status: '.$payment->getMethod().' => '.$order->getPaypalPaymentStatus().'<br/>';

Problem solved.

2
$order->getPayment()->getState();

Or try to use getData() to get all informations of your order.

  • It actually gives me a '' ... nothing. $state = $order->getPayment()->getState(); echo 'State'. $state; = empty .... nothing ... Null ... – Rob D. A. Jun 2 '17 at 10:45
  • look my update. – PЯINCƏ Jun 2 '17 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.