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.
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;
}
}
-
-
-
Are you want full module.I have disabled your method for only for admin – Amit Bera♦ Feb 11 '15 at 6:00
-
I already module it's works good.i am apply your solution if it's work then nothing i needed more. – Jaydeep Sinh Parmar Feb 11 '15 at 6:04
-
Amit can you tell me how can i know my payment method code? – Jaydeep Sinh Parmar Feb 11 '15 at 6:13
Please check the last Answer for this following stackOverflow Link:
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)
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
-
-
It shouldn't. Make sure you have selected the correct option as the current configuration drop down – Sukeshini Feb 11 '15 at 5:58
-
I think you tell me to disable system->configuration->Sale->payment-method->My-Method Enable = No. – Jaydeep Sinh Parmar Feb 11 '15 at 6:08
-
Yes, that's correct. But ensure what is the configuration scope you selected. – Sukeshini Feb 11 '15 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. – Jaydeep Sinh Parmar Feb 11 '15 at 6:52