cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9.2.3 - How to include Guest customer in Observer?

Re: Magento 1.9.2.3 - How to include Guest customer in Observer?

@Aveeva 

 

Use this code:

<?php
class Gta_FilterPaymentGateway_Model_Observer
{
    public function paymenter(Varien_Event_Observer $observer)
    {
        if($observer->getMethodInstance()->getCode() == 'paytm_cc'){
            if(!Mage::getSingleton('customer/session')->isLoggedIn()){
                $result = $observer->getResult();
                $result->isAvailable = false;
            }else{
                $currentCustomerGroup = (int)Mage::getSingleton('customer/session')->getCustomerGroupId();
                if($currentCustomerGroup != 9){
                    $result = $observer->getResult();
                    $result->isAvailable = false; 
                }
            }
        }
    }
}
Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.