3

I design one payment gateway But It's hosted payment so i want remove that payment method for admin order and reorder.so please some one tell me how to disable this method only for admin orders like Paypal standard.

4 Answers 4

6

Jaydeep Sinh Parmar,can do this by Magento Event/Observer

First,using payment_method_is_active disable on depends current store.

Code for this:

Module config.xml code:

<global>
    <events>
    <payment_method_is_active>
        <observers>
            <paymentfilter_payment_method_is_active>
            <type>singleton</type>
            <class>yourmodel/observer</class>
            <method>filterpaymentmethod</method>
            </paymentfilter_payment_method_is_active>
        </observers>
    </payment_method_is_active>
    </events>
</global>

Observer code is:

<?php
class YOURNANESPACE_YOURMODULE_Model_Observer {

    public function filterpaymentmethod(Varien_Event_Observer $observer) {
    /* call get payment method */
    $method = $observer->getEvent()->getMethodInstance();

     /*   get  Quote  */
     $quote = $observer->getEvent()->getQuote();

    /* Disable Your payment method for   adminStore */
    if (Mage::app()->getStore()->isAdmin()):
        if($method->getCode()=='YOUR_PAYMENT_METHOD_CODE' ){
        $result = $observer->getEvent()->getResult();   
         $result->isAvailable = false;
        }
    endif;
}
}
7
  • Can you tell me which event observer? Feb 11, 2015 at 5:45
  • So amit what i have to write in observer. Feb 11, 2015 at 5:54
  • Are you want full module.I have disabled your method for only for admin
    – Amit Bera
    Feb 11, 2015 at 6:00
  • I already module it's works good.i am apply your solution if it's work then nothing i needed more. Feb 11, 2015 at 6:04
  • Amit can you tell me how can i know my payment method code? Feb 11, 2015 at 6:13
1

Please check the last Answer for this following stackOverflow Link:

https://stackoverflow.com/questions/14011348/disable-payment-options-only-cash-on-delivery-for-particular-product-magento

0
1

Have a look at this extension. It allows you to set payment methods to only be used in the backend http://www.magentocommerce.com/magento-connect/admin-payments.html

The code is available on github (https://github.com/getsquare/Magento-Admin-Payments)

0

Go to System > Configuration and select the Default Config as the current configuration scope. Then select Payment methods tab and disable your payment method.

OR

you can simply disable it in your module's system.xml where the configurations are located

That will done the job for you

7
  • But this way payment method disable for fronted also. Feb 11, 2015 at 5:52
  • It shouldn't. Make sure you have selected the correct option as the current configuration drop down
    – Sukeshini
    Feb 11, 2015 at 5:58
  • I think you tell me to disable system->configuration->Sale->payment-method->My-Method Enable = No. Feb 11, 2015 at 6:08
  • Yes, that's correct. But ensure what is the configuration scope you selected.
    – Sukeshini
    Feb 11, 2015 at 6:38
  • yes if i follow this process with right scope it will surely remove that payment method for back-end as well as front-end at checkout & I don't want to remove that payment method for customer checkout.By the way i find right answer and again thanks for your time. Feb 11, 2015 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.