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

前端 未结 3 476
时光取名叫无心
时光取名叫无心 2021-01-02 16:43

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

3条回答
  •  余生分开走
    2021-01-02 17:09

    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

    
    
        
            
                true
                local
                
                    
                
            
        
    
    

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

    
    
    
        
            0.0.1
        
    
    
    
        
            
                Company_Module_Model
            
        
        
            
                
                    
                        singleton
                        Company_Module/Observer
                        paymentMethodIsActive
                    
                
            
        
    
    
    
    

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

    getMethodInstance();
            $result = $observer->getResult();
    
            if ($instance->getCode() == "checkmo") {
                if (Mage::app()->getStore()->isAdmin()) {
                    $result->isAvailable = true;
                } else {
                    $result->isAvailable = false;
                }
            }
        }
    }
    

提交回复
热议问题