货到付款已激活仅管理员(未启用前端)-Magento? [英] Cash On Delivery activated Admin Only ( Not Frontend enabled ) - Magento?

查看:87
本文介绍了货到付款已激活仅管理员(未启用前端)-Magento?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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.

我不希望在Magento Frontend Store中显示此内容.

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

可以帮我吗?

推荐答案

有多种方法可以实现此目的,但是它们需要熟悉Magento生态系统.我不鼓励使用CSS对最终用户隐藏它,因为对CSS有一点了解的人可以轻松地将其隐藏起来并获得购买产品的免费访问权.

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.

我最喜欢的方法是启用支票/汇票"方法,并为自己创建一个小模块,如下所示.先前的考虑都没有在这里起作用.

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.

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

这篇关于货到付款已激活仅管理员(未启用前端)-Magento?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆