9

I need to enable the Cheque / Money Order payment method to enable our clients call centre team to create orders in the admin.

However we do not want customers buying online through the website to use this payment method.

Does anybody know how I might be able to do this?

Regards, Fiona

Fiona
  • 1,599
  • 5
  • 24
  • 38
  • Take a look @ - http://stackoverflow.com/questions/14011348/disable-payment-options-only-cash-on-delivery-for-particular-product-magento - http://stackoverflow.com/questions/14022921/cash-on-delivery-activated-admin-only-not-frontend-enabled-magento/14023210#14023210 – MagePal Extensions Jan 14 '14 at 17:53

5 Answers5

14

Two options:

1)
Override (using never change the original or add a /local/Mage/ override) the payment method (or just modify it if it's your own method), and add this:

protected $_canUseInternal              = true;
protected $_canUseCheckout              = false; 
protected $_canUseForMultishipping      = false;

2)
Create an observer on the frontend for "payment_method_is_active" event, and set to inactive the methods you don't want to show on the frontend:

   <config>
       <frontend>
           <events>
        <payment_method_is_active>
            <observers>
                       ... your observer here


 public function your_observer($event){

      $method = $event->getMethodInstance();
      $result = $event->getResult();

      if( $method should not be active in frontend ){

            $result->isAvailable = false;
      }

 }
Enrique
  • 4,693
  • 5
  • 51
  • 71
  • This is the most relevant comment and most accurate. When developing new modules, you need to think about future use as well. You currently do not allow front-end usage of the module, but you could in future. And this way you can later apply restrictions to when the payment method is visible to customer (order value, special items, ..). Observers in Magento are really powerful, learn to use them. – Matic Krajnc Oct 10 '16 at 09:40
  • if you develop a module you could just add an option in the backend for this. – WonderLand Mar 22 '17 at 06:41
0

If you enable it in the global config-view and then disable it for your store/website view does that work? (Don't have a system handy to test...)

Greg
  • 10,350
  • 1
  • 26
  • 35
  • Thanks Greg for the suggestion, however unfortunately that didn't work. Just tried it. – Fiona Jan 20 '10 at 11:08
  • It's a good suggestion, but doesn't work because the admin order creation screen will use the configuration scope of the customer's website – Erfan Sep 30 '15 at 15:28
0

I tried Enriques solution # 1 to hide one payment method in frontend, only to show it in admin:

protected $_canUseInternal              = true;
protected $_canUseCheckout              = false; 
protected $_canUseForMultishipping      = false;

Seems to work fine when I am testing, and in general..

BUT.. I still sometimes get normal orders that uses my "hidden" payment method. Like Magento sometimes fails to use the piece of code above.

Anyone knows why this happens, and how to avoid?

Thanks

-Espen

Espen
  • 147
  • 4
  • 16
0

Check config setting like below example. If you want to check that customcarrier_fastways is active then use code similar to this:

$shippingMethod="customcarrier_fastways";
$shippingMethodActive= Mage::getStoreConfig('carriers/'.$shippingMethod.'/active', Mage::app()->getStore()->getId());
$showAtFront= Mage::getStoreConfig('carriers/'.$shippMethod.'/showatfront', Mage::app()->getStore()->getId());
    if($shippingMethodActive && $showAtFront){
    // do  something here...
    }

While variables is defined in xml file as below:

<carriers translate="label" module="shipping">
        <groups>

             <customcarrier_fastways translate="label">
                <label>Fastways</label>
                <frontend_type>text</frontend_type>
                <sort_order>1</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
                <fields>

                    <active translate="label">
                        <label>Enabled</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>1</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>0</show_in_store>
                    </active>           


                     <showatfront translate="label">
                        <label>Show on checkout</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>1</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>0</show_in_store>
                    </showatfront>

                </fields>
            </customcarrier_fastways>

        </groups>
    </carriers>
leek
  • 11,803
  • 8
  • 45
  • 61
Ashwani Panwar
  • 3,819
  • 3
  • 46
  • 66
-1

Just found this, looks like it's what you're after: http://www.magentocommerce.com/boards/viewthread/38765/P15/

acorncom
  • 5,975
  • 1
  • 19
  • 31