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

查看:15
本文介绍了货到付款激活仅限管理员(未启用前端)- 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 前端商店中.

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.

我最喜欢的方法是启用 Check/Money order 方法,并为自己创建一个小模块,如下所示.前面的考虑都没有在这里产生任何影响.

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天全站免登陆