rss
twitter
    Find out what I'm doing, Follow Me :)

Monday, February 1, 2010

Pin It

Widgets

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;
    }
 }

Source : http://inchoo.net/ecommerce/magento/magento-how-to-get-all-active-payment-modules/

1 comment:

  1. Hello

    Nice information but I want to make extension that has installment option as I see on FME Extensions, but thanks for this information

    ReplyDelete