English 中文(简体)
玉米支付方法——只能管理
原标题:magento payment methods - enable for admin only
  • 时间:2010-01-18 11:30:04
  •  标签:
  • magento

我需要使Cheque /金钱命令支付方法能够使我们客户求助中心团队能够在行政上制定命令。

然而,我们并不希望客户通过网站在线购买这一付款方法。

是否有任何人知道我如何能够这样做?

Regards, Fiona

问题回答

两种选择:

1)
Override (using never change the original or add a /local/Mage/ override) the payment method (or just modify it if it s your own method), and add this:

protected $_canUseInternal              = true;
protected $_canUseCheckout              = false; 
protected $_canUseForMultishipping      = false;

2)
Create an observer on the frontend for "payment_method_is_active" event, and set to inactive the methods you don t want to show on the frontend:

   <config>
       <frontend>
           <events>
        <payment_method_is_active>
            <observers>
                       ... your observer here


 public function your_observer($event){

      $method = $event->getMethodInstance();
      $result = $event->getResult();

      if( $method should not be active in frontend ){

            $result->isAvailable = false;
      }

 }

如果你能够在全球汇合中进行,然后将其从您的仓储/网站角度去看,那么这项工作吗? (无系统可检测......)

我试图将第1号解决方案隐藏在前线,只是为了在行政上显示:

protected $_canUseInternal              = true;
protected $_canUseCheckout              = false; 
protected $_canUseForMultishipping      = false;

在我进行测试时,请看一下,总的来说。

BUT.。 我有时仍然收到使用我的“隐藏”支付方法的正常命令。 与Magento一样,有时未能使用上述法典。

任何人都知道这种情况发生的原因以及如何避免?

增 编

- Espen

Check config setting like below example. If you want to check that customcarrier_fastways is active then use code similar to this:

$shippingMethod="customcarrier_fastways";
$shippingMethodActive= Mage::getStoreConfig( carriers/ .$shippingMethod. /active , Mage::app()->getStore()->getId());
$showAtFront= Mage::getStoreConfig( carriers/ .$shippMethod. /showatfront , Mage::app()->getStore()->getId());
    if($shippingMethodActive && $showAtFront){
    // do  something here...
    }

虽然在xml文档中界定变量如下:

<carriers translate="label" module="shipping">
        <groups>

             <customcarrier_fastways translate="label">
                <label>Fastways</label>
                <frontend_type>text</frontend_type>
                <sort_order>1</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
                <fields>

                    <active translate="label">
                        <label>Enabled</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>1</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>0</show_in_store>
                    </active>           


                     <showatfront translate="label">
                        <label>Show on checkout</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>1</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>0</show_in_store>
                    </showatfront>

                </fields>
            </customcarrier_fastways>

        </groups>
    </carriers>

Just found this, looks like it s what you re after: http://www.magentocommerce.com/boards/viewthread/38765/P15/





相关问题
Magento addFieldToFilter allow NULLs

When using the Magento collection method addFieldToFilter is it possible to allow filtering by NULL values? I want to select all the products in a collection that have a custom attribute even if no ...

Get product link from Magento API

I am new to Magento and using their API. I need to be able to get the product url from the API call. I see that I can access the url_key and url_path, but unfortunately that s not necessarily what ...

magento extension installation

I want to install a Magento extension in WAMP, but not from the Magento connect system. How can I do this? I have the module (extension) code and I already installed the sample data in the Magento ...

Link to a specific step in onepage checkout

Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...

How do I filter a collection by a YesNo type attribute?

I have a ‘featured’ attribute, which has a Yes/No select-list as the admin input. I presume that the values for Yes and No are 1 and 0, as they are for every other Yes/No list. However, if I try and ...

热门标签