Skip to main content
6 of 7
replaced http://magento.stackexchange.com/ with https://magento.stackexchange.com/

you can do this using magento event observer,create an event on payment_method_is_active and depednds on customer group disable and enable payment method:

check this link: Implementing payment method per currency

and you need do on some change in observer.php I have trying to example and try to modify according to you

   public function filterpaymentmethod(Varien_Event_Observer $observer) {
        /* call get payment method */
        $method = $observer->getEvent()->getMethodInstance();
if(Mage::getSingleton('customer/session')->isLoggedIn()) {

 $roleId = Mage::getSingleton('customer/session')->getCustomerGroupId();
 $role = Mage::getSingleton('customer/group')->load($roleId)->getData('customer_group_code');

      if($method->getCode()=='purchaseorder'){
            $quote = $observer->getEvent()->getQuote();

            if($role == $yourcustomergroupid){
              $result = $observer->getEvent()->getResult();   
              $result->isAvailable = true;
              return;
            }else{
               $result = $observer->getEvent()->getResult();   
               $result->isAvailable = false;
            }
        }

     if($method->getCode()=='checkmo'){
            $quote = $observer->getEvent()->getQuote();

            if($role == $yourcustomergroupid){
              $result = $observer->getEvent()->getResult();   
              $result->isAvailable = true;
            return;
            }else{
              $result = $observer->getEvent()->getResult();   
              $result->isAvailable = false;
            }
        }
}

}

Note: If you not getting customer group id from session then you need tp load customer by customer id(which is must get from session) for getting customer group from session try below:

http://stackoverflow.com/questions/9242390/showing-which-group-a-customer-belongs-to-in-magento http://xhtmlandcsshelp.blogspot.in/2010/12/get-customer-group-id-in-magento.html

Let me know if you have any confusion

Amit Bera
  • 77.7k
  • 20
  • 124
  • 239