Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cash On Delivery activated Admin Only ( Not Frontend enabled ) - Magento?

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 ???

like image 470
user1689231 Avatar asked Dec 24 '12 15:12

user1689231


People also ask

How do I enable cod in Magento?

After that, go to Sales > Payment Methods > Cash On Delivery Payment from the left side panel. Then, select “Yes” in the “Enabled” field to activate the cash on delivery payment method in your Magento 2 store.

How do I change the default payment method in Magento 2?

To set default payment method in Magento checkout: Go to Stores > Configuration > Magefan Extension > Better Checkout. Set the Default Payment Method in the General Configuration section.

How do I set up cash on delivery?

How Does Cash on Delivery Work? Buyers place an order, for example, on a website, and request delivery. The customer does not make payment while ordering the item and chooses cash on delivery as a payment method. Once the order is placed, an invoice is prepared by the seller, which is attached to the parcel.


1 Answers

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;
            }
        }
    }
}
like image 131
Joseph at SwiftOtter Avatar answered Sep 28 '22 04:09

Joseph at SwiftOtter