I need to get a collection of all payment methods and list the quantity of orders on each of them, how can I do that programmatically?

2 Answers 2


You can make the array to collection in the following way:

$allActivePaymentMethods = Mage::getModel('payment/config')->getActiveMethods();
$collection = new Varien_Data_Collection();
foreach($allActivePaymentMethods as $row){
   $rowObj = new Varien_Object();

//now you can get the data using collection way
foreach($collection as $_data){
  • It kinda of worked, but it's making a collection with null values, however, when I print_r the array(not the collection) it's returning an array with these values: Array ( [id] => free [store] => ) Array ( [id] => cashondelivery [store] => ) Array ( [id] => paypal_billing_agreement [store] => ) I need to make my collection show those values, and also need to show the quantity of orders made with the payment method in question. Commented May 29, 2018 at 12:25
  • Actually there is object in each array, So you need to build the data array before converting to an object. I have modified the answer, it should work. Commented May 30, 2018 at 7:37

These are class methods app/code/core/Mage/Payment/Model/Config.php

To get a list with all payments active and inactive:

$allAvailablePaymentMethods = Mage::getModel('payment/config')->getAllMethods();

To get a list with all active payment methods:

$allActivePaymentMethods = Mage::getModel('payment/config')->getActiveMethods();

To get a list with all credit cards that Magento supports:

$allCcTypes = Mage::getModel('payment/config')->getCcTypes();
  • I tried this solution a while ago and can't use that because I need a collection, not an array, also tried to convert those arrays to a collection object but for no avail. Commented May 28, 2018 at 19:47
  • Do you know how to efficiently convert those arrays on a collection, so I can display on a grid? Commented May 28, 2018 at 19:57
  • Sorry, but I do not know how to implement it. Commented May 28, 2018 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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