Skip to main content
replaced http://magento.stackexchange.com/ with https://magento.stackexchange.com/
Source Link
   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$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$role == $yourcustomergroupid){
              $result = $observer->getEvent()->getResult();   
              $result->isAvailable = true;
            return;
            }else{
              $result = $observer->getEvent()->getResult();   
              $result->isAvailable = false;
            }
        }
}

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

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

}
added 41 characters in body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239
Loading
added 1470 characters in body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239
Loading
added 1470 characters in body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239
Loading
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239
Loading