7

I am using magento for a time now. I wanted to know is it possible to enable Cash On Delivery option for admin use only. I want to use it as Store Pickup...

So this way manual orders can be only created in admin panel for those who want Store Pickup.

I dont want this to be shown in Magento Frontend Store.

Can you all help me out ???

user1689231
  • 107
  • 1
  • 8

3 Answers3

18

There are a number of ways to achieve this, but they require a familiarity with the Magento ecosystem. I would discourage using CSS to hide it from the end user, because someone that was slightly knowledgeable about CSS could easily unhide it and gain free access to purchase your products.

I also suggest not override core files (even if you are not editing them), as that will cause upgrade problems in the future.

The solid way:

My favorite method would be to enable to Check/Money order method, and create yourself a small module, like this. Neither of the previous considerations make any effect here.

/app/etc/modules/Company_Module.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Company_Module>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Payment/>
            </depends>
        </Company_Module>
    </modules>
</config>

/app/code/local/Company/Module/etc/config.xml

<?xml version="1.0"?>
<config>
<modules>
    <Company_Module>
        <version>0.0.1</version>
    </Company_Module>
</modules>

<global>
    <models>
        <Company_Module>
            <class>Company_Module_Model</class>
        </Company_Module>
    </models>
    <events>
        <payment_method_is_active>
            <observers>
                <company_module>
                    <type>singleton</type>
                    <class>Company_Module/Observer</class>
                    <method>paymentMethodIsActive</method>
                </company_module>
            </observers>
        </payment_method_is_active>
    </events>
</global>

</config>

/app/code/local/Company/Module/Model/Observer.php

<?php

class Company_Module_Model_Observer
{
    public function paymentMethodIsActive($observer)
    {
        $instance = $observer->getMethodInstance();
        $result = $observer->getResult();

        if ($instance->getCode() == "checkmo") {
            if (Mage::app()->getStore()->isAdmin()) {
                $result->isAvailable = true;
            } else {
                $result->isAvailable = false;
            }
        }
    }
}
rybo111
  • 12,240
  • 4
  • 61
  • 70
Joseph at SwiftOtter
  • 4,276
  • 5
  • 37
  • 55
  • Thanks @JMax, I did the same. But I am not good at the programming part very much. What does this code do ?? – user1689231 Dec 25 '12 at 11:58
  • It checks to see if the request is coming from the admin area, and if it is, we say the payment method is active, otherwise, we say the payment method is non-active. It's bullet proof. – Joseph at SwiftOtter Dec 25 '12 at 14:47
  • Hi @JMax, I tried this. I made this method active but the problem is I dont want it to be shown in Front end.. But its available in the front end too. I want to hide it.. ?? Any suggestions ? – user1689231 Dec 26 '12 at 04:07
  • 3
    Use $instance->getCode() instead of $instance->getName() – Kamal Joshi Apr 16 '13 at 07:59
  • 1
    Also, you can use `` instead of `` event namespace so you don't have to check for whether the event gets fired in frontend or adminhtml – Erfan Sep 30 '14 at 07:41
  • From this answer I made https://github.com/miguelbalparda/MB_AdminMoney with some more options to make it more usable to the end user. – mbalparda Nov 28 '14 at 19:32
1

To hide in the front end, you must be set to false to the protected $_canUseCheckout = false; to your payment method.

To display in the admin end, you must be set to true to the protected $_canUseInternal = true; to your payment method.

PRABU K
  • 11
  • 1
-4

A very easy way, but maybe not the cleanest way you could do this:

  1. Enable Cash On Delivery for the store.
  2. Hide it from the front end using CSS.

Using CSS to achieve this would hide the option from the general public, but would not prevent a web developer who is knowledgable with CSS to go find it and place a cash on delivery order - though I cant think of any reason someone would purposely do this since they won't achieve much by placing the order.

EDIT :

To hide Cash On Delivery add this to your CSS:

input#p_method_cashondelivery { display: none; }
label[for=p_method_cashondelivery] { display: none; }
ronnz
  • 167
  • 2
  • 11