如果管理员启用了设置,如何为前端禁用购买付款方式

时间:2016-06-14 13:20:22

标签: php magento

我的网站上有一个购买付款方式模块,我希望购买付款方式仅在管理员中可见,而不是在付款步骤的前端。我为管理员创建配置设置如果管理员启用此设置后仅购买付款方式显示在管理员端。

我的模型文件

var self = this;

}

我只想要$ isActive = Mage :: getStoreConfig('purchaseorder / purchaseorder_config / enabled')的值;是1然后

<?php
class Magentomod_Purchaseorder_Model_Method_Purchaseorder extends Mage_Payment_Model_Method_Abstract
{

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

protected $_code  = 'purchaseorder';
protected $_formBlockType = 'payment/form_purchaseorder';
protected $_infoBlockType = 'payment/info_purchaseorder';

public function isAvailable($quote = null) {

}
public function assignData($data)
{
    if (!($data instanceof Varien_Object)) {
        $data = new Varien_Object($data);
    }

    $this->getInfoInstance()->setPoNumber($data->getPoNumber());
    return $this;
}

否则

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

任何帮助都将受到高度赞赏。

1 个答案:

答案 0 :(得分:0)

您的探索会稍微困惑,但猜测您需要:

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

public function __construct()
{
    if(Mage::getStoreConfig('purchaseorder/purchaseorder_config/enabled') === 1) {

        $this->_canUseCheckout              = true; 
        $this->_canUseForMultishipping      = true;

    }
}