首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Magento自定义支付iFrame模块错误

Magento自定义支付iFrame模块错误
EN

Stack Overflow用户
提问于 2013-02-25 15:38:03
回答 2查看 1.5K关注 0票数 0

我试图编码一个Magento支付模块,它将调用一个iFrame而不是标准的CC块。但是,当运行下面的代码时,我会得到以下错误:

致命错误:在第106行的/opt/bitnami/apps/magento/htdocs/app/code/core/Mage/Payment/Helper/Data.php中调用非对象上的成员函数setMethod()

Config.xml:

代码语言:javascript
复制
 <?xml version="1.0"?>
<config>
    <modules>
       <Lynch_Peach>
<!-- declare module's version information for database updates -->
          <version>0.1.0</version>
       </Lynch_Peach>
    </modules>

    <global>
    <blocks>
        <peach>
            <class>Lynch_Peach_Block</class>
        </peach>
    </blocks>


        <models>
            <peach>
  <class>Lynch_Peach_Model</class>
            </peach>
        </models>

<!-- declare resource setup for new module -->
        <resources>
<!-- resource identifier -->
            <peach_setup>
<!-- specify that this resource is a setup resource and used for upgrades -->
                <setup>
<!-- which module to look for install/upgrade files in -->
                    <module>Lynch_Peach</module>
                </setup>
<!-- specify database connection for this resource -->
                <connection>
<!-- do not create new connection, use predefined core setup connection -->
                    <use>core_setup</use>
                </connection>
            </peach_setup>
            <peach_write>
                <connection>
                  <use>core_write</use>
                </connection>
            </peach_write>
            <peach_read>
               <connection>
                <use>core_read</use>
              </connection>
            </peach_read>
        </resources>
    </global>

<!-- declare default configuration values for this module -->
    <default>
<!-- 'payment' configuration section (tab) -->
        <payment>
<!-- 'peach' configuration group (fieldset) -->
            <peach>
<!-- by default this payment method is inactive -->
                <active>0</active>
<!-- model to handle logic for this payment method -->
                <model>peach/paymentMethod</model>
<!-- order status for new orders paid by this payment method -->
                <order_status>pending</order_status>
<!-- default title for payment checkout page and order view page -->
                <title>Peach Payments</title>

                <cctypes>VI,MC</cctypes>

                <payment_action>authorize_capture</payment_action>
                <allowspecific>0</allowspecific>
            </peach>
         </payment>
    </default>
</config>

支付Method.php

代码语言:javascript
复制
<?php
class Lynch_Peach_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc
{

    protected $_code = 'peach';
    protected $_formBlockType = 'peach/form';
    protected $_isGateway               = false;
    protected $_canAuthorize            = false;
    protected $_canCapture              = false;
    protected $_canCapturePartial       = false;
    protected $_canRefund               = false;
    protected $_canVoid                 = false;
    protected $_canUseInternal          = false;
    protected $_canUseCheckout          = true;
    protected $_canUseForMultishipping  = false;
    protected $_canSaveCc = false;


  public function createFormBlock($name)
    {
        $block = $this->getLayout()->createBlock('peach/form', $name)
            ->setMethod('peach')
            ->setPayment($this->getPayment())
            ->setTemplate('peach/form.phtml');

        return $block;
    }

}
?>

Form.php:

代码语言:javascript
复制
<?php
class Lynch_Peach_Block_Form extends Mage_Payment_Block_Form
{
    // {{{ _construct()
    /**
     * _construct() 
     */    
    protected function _construct()
    {
        parent::_construct();
        $$this->setTemplate( 'peach/form.phtml' );
    }
    // }}}
}

?>
EN

回答 2

Stack Overflow用户

发布于 2013-02-25 17:41:31

表单构造函数中有双$$。

票数 0
EN

Stack Overflow用户

发布于 2013-10-14 05:50:46

您可以通过应用以下更改来尝试。

代码语言:javascript
复制
protected $_formBlockType = 'peach/form';

在上面的变化就像折叠式,

代码语言:javascript
复制
protected $_formBlockType = 'peach/Form';

通常,如果在Windows环境中运行应用程序,这并不重要。但这可能是在非windows环境中运行时出现的问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15070612

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档