Magento: How to get all active payment modules

4 Comments 27th JAN 2010 | Posted by Domagoj Potkoc in Magento

Magento: How to get all active payment modules

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;

	} 

}

If you like what you read, please share it.

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Yahoo! Bookmarks
  • Reddit
  • Technorati
  • Twitter
  • StumbleUpon
  • LinkedIn
  • Netvibes
  • NewsVine
  • Sphinn
  • Tumblr
  • Posterous

To post code in comments, place your code inside [code] and [/code] tags.

There are 4 comments (Add Yours +)

  • 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

  • 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

  • This is relay helpful ,,
    I searched much , but i didn’t find…..

    anyway ,, thanks

  • 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

Leave a Comment

Please wrap all source codes with [code][/code] tags.
Magento Design and Development | Magento SEO | iPhone Application Development Web Application Development with ZEND | WordPress Ecommerce | WordPress development
Sitemap

Inchoo - webappsolutions | 2009