Reputation: 135
how can i get value from $order->getPayment()->getMethodInstance()? With a print_r I have this return:
[credit_card_token] => 849832748932uhdfhsiufhi [credit_card_owner] => NoNoNoNo [installment_quantity] => 2 [installment_value] => 98.11 ) ); etc
I need the value from installment_quantity and installment_value
thank you
Upvotes: 0
Views: 73
Reputation: 4584
this "$order->getPayment()->getMethodInstance()
" returns array, so you need to assign this to a variable and get values by using keys.
$credit_card_info=$order->getPayment()->getMethodInstance();
Now you can get values by using keys.
$credit_card_token=$credit_card_info['credit_card_token'];
$credit_card_owner=$credit_card_info['credit_card_owner'];
Upvotes: 1
Reputation: 13128
That method is returning the array you need, so simply assign it to a variable and access the items you need:
$data = $order->getPayment()->getMethodInstance();
$quantity = $data['installment_quantity'];
$value = $data['installment_value'];
Upvotes: 2