Magento: How to get all active payment modules
4 Comments 27th JAN 2010 | Posted by Domagoj Potkoc in Magento

This code bellow will get you all active Magento payment modules. This example below return an array which you can use to create drop down menu or something else in Magento’s front-end or admin sections.
class Inchoo_Vendor_Model_Activpayment
{
public function getActivPaymentMethods()
{
$payments = Mage::getSingleton('payment/config')->getActiveMethods();
$methods = array(array('value'=>'', 'label'=>Mage::helper('adminhtml')->__('--Please Select--')));
foreach ($payments as $paymentCode=>$paymentModel) {
$paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
$methods[$paymentCode] = array(
'label' => $paymentTitle,
'value' => $paymentCode,
);
}
return $methods;
}
}
To post code in comments, place your code inside [code] and [/code] tags.


















January 27th, 2010 at 10:29
And getActiveMethods() method has a bug , dependent on store based settings in multi store/website environment “googlecheckout/payment” will always return as active method even if it’s disabled
January 29th, 2010 at 11:28
i m newbie in magento, how to use this module i want the paypal payment module to be shown to my customers while they shop
can u suggest me some thing to do this paypal enable
thanks
February 12th, 2010 at 17:40
This is relay helpful ,,
I searched much , but i didn’t find…..
anyway ,, thanks
June 28th, 2010 at 17:58
Hi,
Very useful article. One of my college used this.
Can you explain what is what in this code.
I want to get all active shipping methods.
Regards,
Saurabh