Magento payment method on selected currency

images4

Magento payment method on selected currency, if you want to use your custom payment module for selected currencies, no worries you can do it by adding few lines of code in your module.

In config.xml

<events>
 <payment_method_is_active>
    <observers>
       <paymentfilter_payment_method_is_active>
           <type>singleton</type>
           <class>Namespace_Modulename_Model_Observer</class>
           <method>paymentMethodIsActive</method>
       </paymentfilter_payment_method_is_active>
     </observers>
  </payment_method_is_active>
</events>

In Observer file

   public function paymentMethodIsActive(Varien_Event_Observer $observer) {
        $event           = $observer->getEvent();
        $method          = $event->getMethodInstance();
        $result          = $event->getResult();
        $currencyCode    = Mage::app()->getStore()->getCurrentCurrencyCode();
        if($method->getCode() == 'modulename_paymentmethodname'){
            if($currencyCode == 'INR'){
                $result->isAvailable = true;
            }else{
                $result->isAvailable = false;
            }
        }
        return $result;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *